dashbrew
dashbrew copied to clipboard
How do I enable a PHP extension (like mcrypt)?
This is what I have in environment.yaml
:
os::packages:
php5-mcrypt: true
I tried that alone and
php::builds:
5.6.0:
installed: true
default: true
variants: dev
extensions:
xdebug:
enabled: true
version: stable
mcrypt:
enabled: true
version: stable
xhprof:
enabled: true
version: latest
fpm:
port: 9002
autostart: true
It says:
==> default: PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mcrypt.so' in Unknown on line 0
==> default: /opt/phpbrew/bashrc: eval: line 126: syntax error near unexpected token `('
==> default: /opt/phpbrew/bashrc: eval: line 126: `Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mcrypt.so' in Unknown on line 0 export PHPBREW_ROOT=/opt/phpbrew export PHPBREW_HOME=/opt/phpbrew export PHPBREW_LOOKUP_PREFIX= export PHPBREW_PHP=5.6.0 export PHPBREW_PATH=/opt/phpbrew/php/5.6.0/bin'
==> default: Starting php-fpm...
==> default: [05-Mar-2015 11:39:12] NOTICE: PHP message: PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mcrypt.so' in Unknown on line 0
Now I removed those lines and it thinks I'm still trying to install mcrypt. So I do vagrant ssh
and can't even do a ls
because I just get:
PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'mcrypt.so' in Unknown on line 0
After not using the config file, then using it again, it outputs a bunch of errors about letting stuff unconfigured. What a mess :/
Enabling extensions for system php version is bit different than enabling extensions for phpbrew php versions.
In order to enable an extension for system php, use the OS package manager to install and enable the extension. In case of mcrypt
you can use:
os::packages:
php5-mcrypt: true
In order to enable an extension for a php version installed by phpbrew, use the variant for this extension if there is one (check the available variants) and if there isn't one, define it using the extensions: directive
.
In case of mcrypt
, there is a phpbrew variant for it, can use:
php::builds:
5.6.0:
installed: true
default: true
variants:
- dev
- mcrypt
extensions:
xdebug:
enabled: true
version: stable
xhprof:
enabled: true
version: latest
fpm:
port: 9002
autostart: true
Make sure to upgrade your working copy to the latest version 0.2.1
Thanks, it helped me too