4. Rebuilding Extensions for Production
While we are on the subject of build processes and before we go deeper into building a PHP extension skeleton, it makes sense to explain how to rebuild the extension for production when it’s ready. Actually, you may try this right now. At first, you’ll need PHP development tools especially for your PHP build. It may be a system package.
Installation for Ubuntu/Debian:
$ sudo apt-get install php-devInstallation for RedHat/Fedora:
$ sudo dnf install php-develFor Zend Server you should get “php-dev-zend-server” package installed (through Zend Server installer or system package manager) and use its components in the PATH.
$ export PATH=/usr/local/zend/bin:$PATHThe building is very similar to the “DEBUG” build. The difference is that now we use “phpize” from “production” build. (PATH shouldn’t include our DEBUG PHP build directory.)
$ phpize
$ ./configure
$ make
$ sudo make installAdd extension into php.ini:
$ vi /etc/php.iniAdd the following line:
extension=test.soCheck that extension is loaded and works:
$ php -m | grep test
test
Now you can restart your web server or PHP-FPM and start using your extension in a web environment.