How does one add a built-in extension library for PHP? what should I do when PHP has been installed on the server and requires additional extensions for PHP? You do not need to reinstall PHP. with phpize, you can directly install the extension library on the basis of the original PHP.
This compilation only compiles the PHP Extension Library separately, and then adds the compiled extension library to the currently running php. This does not affect the current php re-compilation.
Next we will demonstrate how to install xsl extensions (not necessarily common, just as an example)
Practice 1:
1. find the source code directory of the currently running php version, such as the php-5.2.3. Go to the xsl Extension Library Directory.
$ Cd/home/pkgs/php-5.3.3/ext/xsl
2. call the phpize program to generate the compilation configuration file.
$/Home/app/php5.3.3/bin/phpize
3. Compile the extension library and execute the following configure and make Commands respectively.
$./Configure-with-php-config =/home/app/php5.3.3/bin/php-config
After this step is passed, execute the make command. if configure fails, find the cause of the error.
$ Make
# After make is successfully executed, the generated extension library file is in the modules subdirectory of the current directory,
Such as/home/php-5.3.3/ext/curl/modules/xsl. so
4. configure the php. ini file
# Copy the compiled extension library file to the PHP extension directory and view the phpinfo information ..
$ Cp/home/pkg/php-5.3.3/ext/xsl/modules/xsl. so/home/app/php5.3.3/lib/php/extensions/no-debug-non-zts-20090626
# Locate the location for setting the extension directory in the php. ini file, set the extension path to the Apache2modules directory, and add the extension Library location.
Extension_dir/home/app/php5.3.3/lib/php/extensions/no-debug-non-zts-20090626"
Extension = xsl. so
5. restart php and view the phpinfo information. the added xsl Extension Library is displayed. (If multiple php-fpm processes exist, restart the main process: kill-USR2 pid)