Add curl extension library for PHP in Linux and Windows

Source: Internet
Author: User

This compilation only compiles the PHP extension library separately, and then adds the compiled PHP extension Library to the currently running PHP, therefore, it has no impact on the currently running PHP.

Assume that the compiled PHP Directory is in the/usr/local/PhP4 directory; Apache is in the/usr/local/apache2 directory; PHPSource codeUnder the/home/php-4.4.7 directory. If the actual directory is different from the assumed directory, make adjustments in the following command.

1. Find the source of the currently running PHP versionCodeDirectory, such as a php-4.4.7. Enter the curl extension library directory.
$ CD/home/php-4.4.7/EXT/curl

2. Call phpizeProgramGenerate the compilation configuration file.
$/Usr/local/PhP4/bin/phpize

3. Compile the extension library and execute the following configure and make commands respectively.
$./Configure-with-PHP-Config =/usr/local/PhP4/bin/PHP-config
# After configure passes this step, run 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,
For example,/home/php-4.4.7/EXT/curl/modules/curl. So

4. Configure the php. ini file
# Copy the compiled extension library file to The apache2 modules directory.
$ CP/home/php-4.4.7/EXT/curl/modules/curl. So/usr/local/apache2/modules /.
# You can view the phpinfo information to determine the location of the php. ini file and edit it.
# Locate the location of the extension directory in the PHP. ini file and set the extension path to The apache2 modules directory.
Extension_dir = "/usr/local/apache2/modules /"
# Add the extension library location in PHP. ini and set the extension library to be added.
Extension = curl. So
# If you want to add other extension libraries in the future, you only need to compile the PHP extension library and copy it to The apache2 modules directory,
# Add a line at this location to add the name of the compiled extension library file.

5. Restart Apache and view the phpinfo information. The added curl extension library is displayed.

 

Add curl in Windows:

The following settings allow PHP to support curl extension libraries.

1. Modify PHP. ini and remove the comment before the line extension = php_curl.dll.

2. Copy the libeay32.dll and ssleay32.dll files under the PHP installation directory to the C: \ Windows directory.

3. Restart Apache.

In this case, the curl function should be available for viewing phpinfo.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.