Loading extensions in php5-fpm

8k Views Asked by At

I am in the process of experimenting with Zephir on my Nginx/php5-fpm/ubuntu14.04 setup. I followed their tutorial and managed to compile my first Zephir PHP extension with little difficulty. However, when I tried to enable the newly built extension by editing /etc/php5/fpm/php.ini to include

extension=/path/to/test.so

did not show up the test extension upon issuing php -m. I then remembered that to install the mcrypt extension I use php5enmod mcrypt. So I went to /etc/php5/mods-available and created the file test.ini

extension=/path/to/test.so

and then issued a

php5enmod test

A simple

service php5-fpm restart && php -m

later and lo & behold the test extension was present! All very good but I still do not understand how php5enmod does its magic. It clearly is not writing to the php.ini file. I'd be much obliged to anyone who might be able to explain.

2

There are 2 best solutions below

0
On BEST ANSWER

php5enmod simply creates a symlink from the usual conf.d (for example: /etc/php5/fpm/conf.d) directoy to point to where the real files are in mods-available, prefixed with a number that indicates the priority (default: 20) of the module.

0
On

I inadvertently ran php5enmod without sudo. The error messages is interesting:

rolf@two:/etc/php5$ php5enmod curl
ln: failed to create symbolic link '/etc/php5/fpm/conf.d/20-curl.ini': Permission denied
rm: cannot remove '/var/lib/php5/modules/fpm/disabled_by_maint/curl': Permission denied