Home >Operation and Maintenance >CentOS >How to install php curl under centos
centos php curl installation method: First install crul through "make install"; then enter the ext directory in the Linux PHP source program directory and select the required module; finally add the extension module to the configuration file as "extension=curl.so" is enough.
Recommended: "centos Getting Started Tutorial"
Installing PHP under CentOs Extend curl
After the server has been running for a period of time, you may suddenly need to add an extension, such as curl, pdo, xmlrpc, etc., which requires recompiling Linux PHP. Add extensions independently.
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 compile and generate extensions
Enter the ext directory in the Linux PHP source program directory, where the sources of each extension module are stored code, select the module you need, such as the curl module: cd curl executes phpize to generate a compiled file. When phpize is run in the bin directory of the PHP installation directory /usr/local/php5/bin/phpize, an error may be reported: 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 the configuration file and compile Linux PHP to generate the module:
/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/)
3.Linux PHP modification configuration
In Linux PHP.ini, set the extension directory: extension_dir = "/usr/local/php5/lib/php /extensions/no-debug-non-zts-20090626/" and add the extension module reference: extension = curl.so
You don’t need to specify the extension directory here. The default extension directory of PHP.INI is: /usr/local/php5/lib/php/extensions/, give curl.so to CP here, just add extension=curl.so.
4. Check and restart Apache
/usr/local/php/bin/php -v When executing this command, Linux PHP will check whether the configuration file is correct. If there is a configuration error, an error will be reported here. You can troubleshoot the same based on the error message.
Follow the same steps to install other extensions.
The above is the detailed content of How to install php curl under centos. For more information, please follow other related articles on the PHP Chinese website!