Reputation: 16062
I'm trying to add yaml_parse_file
extension on my docker
container.
On the Dockerfile
I add this line to add the extension on the php.ini
file:
echo 'extension=yaml.so' >> /usr/local/etc/php/php.ini
But when I run docker-compose build
I get this warning:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/yaml.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20121212/yaml.so: cannot open shared object file: No such file or directory in Unknown on line 0
When I'm trying to use yaml_parse()
function I get this error:
Fatal error: Call to undefined function yaml_parse() ...
What I'm trying to do is to read a yaml
file inside a controller from a Lumen
project.
How can I enable yaml_parse_file
extension using docker
?
Upvotes: 2
Views: 3072
Reputation: 7134
This PECL extension is not bundled with PHP, see more http://php.net/manual/en/yaml.installation.php.
Just adding extension=yaml.so
in your php.ini
doesn't help you. You must install the PECL extenstion properly, e.g. if you use ubuntu image
$ sudo apt-get install php-pear libyaml-dev
$ sudo pecl install yamL
$ sudo sh -c "echo 'extension=yaml.so' >> /etc/php5/mods-available/yaml.ini"
$ sudo php5enmod yaml
Upvotes: 3