After the server runs for a period of time, it may suddenly need to add an extension, such as curl, pdo, and xmlrpc. This requires you to add the extension independently without re-compiling Linux PHP.
1. Install crul
Wget http://curl.haxx.se/download/curl-7.19.6.tar.gz
Tar-zxvf curl-7.19.6.tar.gz
Cd curl-7.19.6
./Configure -- prefix =/usr/local/curl
Make
Make install
2. Linux PHP compilation and generation Extension
Go to the ext directory in the Linux PHP source code directory, where the source code of each extension module is stored. Select the required module, such as the curl module: cd curl, and run phpize to generate the compilation file, phpize may report the following error when running/usr/local/php5/bin/phpize in the bin directory of the PHP installation directory: Cannot find autoconf. please check your autoconf installation and the $ PHP_AUTOCONF, environment variable is set correctly and then rerun this script. ", you need to install autoconf: yum install autoconf (RedHat or CentOS), apt-get install autoconf (Ubuntu Linux)
Generate a configuration file and compile and generate a module for Linux PHP:
/Usr/local/php5/bin/phpize
./Configure -- with-curl =/usr/local/curl -- with-php-config =/usr/local/php5/bin/php-config
Make
Make install
In this way, curl. so is copied to the corresponding PHP Directory (such as:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626 /)
Added
3. modify the configuration in Linux PHP
In Linux PHP. in ini, set the extension Directory: extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/" and add extension module reference: extension = curl. so
You do not need to specify the extension directory here. the default extension directory of INI is/usr/local/php5/lib/php/extensions. so add extension = curl to CP here. so.
4. Check and restart Apache
When executing this command in/usr/local/php/bin/php-v, Linux PHP checks whether the configuration file is correct. If any configuration error occurs, an error is returned, you can troubleshoot the same issue based on the error information.
Follow these steps to install other extensions.
Author fenyi0