Curl is a FILE Transfer tool using URL syntax. It supports FTP, FTPS, http htpps scp sftp tftp telnet dict file and LDAP. Curl supports SSL certificates, http post, http put, and FTP uploads, kerberos, HTT-based upload, proxy, cookie, user + password proof, file transfer recovery, http Proxy channel and a large number of other useful techniques.
After php is installed, the curl function extension is not enabled by default. You can enable this function extension in the following steps.
Install curl in windows
1. Open the PHP installation directory, search for the following three files: ssleay32.dll, libeay32.dll, and php_curl.dll, and copy them to the system32 folder in the system directory one by one,
2. Modify the php. ini file, find the; extension = php_curl.dll line, remove the previous; number, save, and restart the server.
3. Test. Create a PHP file under the site directory. The content is as follows:
The Code is as follows: |
Copy code |
$ Ch = curl_init ("http://www.bKjia. c0m "); Curl_exec ($ ch ); Curl_close ($ ch ); |
Install curl in linux
Assume that the originally compiled php Directory is under the/usr/local/php5 directory;
Apache is in the/usr/local/apache2 directory;
The php source code is in the/home/kevin125/src directory.
If the actual directory is different from the assumed directory, make adjustments in the following command.
1. Find the source code directory of the currently running php version, such as the 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 and execute the following configure and make commands respectively.
The Code is as follows: |
Copy code |
$./Configure-with-php-config =/usr/local/php5/bin/php-config |
After configure passes this step, 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/kevin125/src/php-5.2.10/ext/curl/modules/curl. so
4. Configure the php. ini file
Copy the compiled extension library file 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 is located and edit it. You can view the phpinfo information to determine the location of the php. ini file.
Find the location for setting the 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 location in php. ini and the extension library to be added.
The Code is as follows: |
Copy code |
Extension = curl. so |