I am running Ubuntu Server 12.04 and prefer to compile PHP myself as opposed to installing it using
apt-get. PHP is running as PHP-FPM.
When compiling extensions, I can set it to be compiled as a shared extension using something like
--with-bcmath=shared and so on.
Are there any benefits to compiling the extensions as shared?
I also noticed that the extensions are compiled into a pretty convoluted folder. On my system (my php prefix is
/usr/local/php-5.4.9) the extensions end up in
Is there a global way to set a folder so that all shared extensions will be compiled in there? I understand that I can do something like
--with-foobar=shared,/usr/local/foobar/ but having to set the extension folder for each shared extension is inefficient and error-prone.
Don’t do that. Leave it as-is.
The “convoluted” directory structure nevertheless ensures that when you build future PHP extensions (that aren’t shipped with PHP) that the build system can find your existing PHP installation and will put them in the right place so that your existing PHP installation can find them.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.