PHP is installed after the default is not enabled Curl feature expansion, the following steps to open this feature extension.
Windows installation Curl
1, open the PHP installation directory, search the following three files Ssleay32.dll, Libeay32.dll and Php_curl.dll, one by one copies to the system directory under the System32 folder,
2, modify php.ini file, find, extension= php_curl.dll line, remove the front of the number, save, restart the server.
3, testing, in the Site directory to create a PHP file, the contents are as follows
The code is as follows |
Copy Code |
$ch = Curl_init ("http://www.111cn.net"); Curl_exec ($ch); Curl_close ($ch); |
Linux Installation Curl
If the original compiled PHP directory in the/USR/LOCAL/PHP5 directory;
Apache in the/usr/local/apache2 directory;
The PHP source code is in the/HOME/KEVIN125/SRC directory.
If the actual directory is inconsistent with the assumed directory, make adjustments in the following command.
1. Locate the source code directory for the currently running PHP version, such as php-5.2.10.
Enter the Curl Extension Library directory.
The code is as follows |
Copy Code |
$CD/home/kevin125/src/php-5.2.10/ext/curl |
2. Call the Phpize program to generate the compilation configuration file.
The code is as follows |
Copy Code |
$/usr/local/php5/bin/phpize |
3. Compile the extension library to perform the following configure and make commands, respectively.
The code is as follows |
Copy Code |
$./configure–with-php-config=/usr/local/php5/bin/php-config |
Configure after this step is passed, the make command is executed and the cause of the error is found if the Configure execution does not pass.
$make
When make is executed successfully, the resulting extension library file is in the modules subdirectory of the current directory, such as/home/kevin125/src/php-5.2.10/ext/curl/modules/curl.so
4. Configure php.ini Files
Copy the compiled extension library files to the Apache2 modules directory.
The code is as follows |
Copy Code |
$CP/home/kevin125/src/php-5.2.10/ext/curl/modules/curl.so/usr/local/apache2/modules/ |
Locate the directory where the php.ini file resides, and then edit. You can determine the location of the php.ini file by viewing the phpinfo information.
Locate the Settings extension directory in the php.ini file, and then set the extension path to the Apache2 modules directory
The code is as follows |
Copy Code |
Extension_dir = "/usr/local/apache2/modules/" |
Set the extension library to add in the php.ini Settings extension Library location.
The code is as follows |
Copy Code |
Extension=curl.so |