Liunx How to configure PHP curl to expand the library

Source: Internet
Author: User
Tags php source code zts

Configure the PHP Curl extension today. First configuration, not yet, I Baidu many methods, but found that online plagiarism is too serious, a method has been reproduced a lot of sites, the key is also written wrong. After a 4-hour ordeal, it was finally configured successfully. method is documented as follows

The first is to download the Curl Expansion Library first

wget HTTPS://CURL.HAXX.SE/DOWNLOAD/CURL-7.53.1.TAR.GZ&&TAR-ZXF curl-7.17.1.tar.gz

./configure--prefix=/usr/local/curl

Make & make Install

The above step is to install Curl extension.

And then test Curl. This command can be used no, curl http://www.5284.net my machine.

Curl: (2) Failed initialization

Don't be afraid, in the confure, add a parameter when adding./configure--prefix=/usr/local/curl--disable-shared

And then you can use it.

Go on, down.

Compiling PHP

This step I have been driven crazy, the online method is a lot of confusion, but also said unclear.

First determine your PHP installation directory, such as my/usr/local/php/

Then find your PHP source code directory. is the source code directory OH. For example, my version is 5.4 var/tmp/php-5.4.45/

After entering the PHP source code directory, there is an ext directory entered into the/var/tmp/php-5.4.45/ext/curl/and finally into the Curl directory

The next step is to call the Phpize program to generate the Yi configuration file naming/usr/local/php/bin/phpize

[Description]phpize

(Phpize is used to extend the PHP module, through the phpize can build PHP plug-in module, whether it is compiled Yi generated php, or through Yum, Apt-get,brew automatically installed PHP, will generate a phpize program,

Phpize is Yi installation time to generate good, the file recorded in the installation of some information, and can not take a phpize from other places to use, in use need to find their own corresponding PHP version of the phpize, when the PHP compiled, The script file will be phpize in the bin directory under the PHP installation directory. So go to install the PHP installation directory to find it)

when generating the Configure configuration file, use--with-php-config=/usr/local/php534/bin/php-config to specify which version of PHP the phpize is to build on, About the Php-config file: It is a file that is placed in the installation directory after the PHP build (installed). Opening the contents of the Phpize file will reveal that variables such as PHP's installation directory are defined.

If the/usr/local/php/bin/phpize does not respond to the hint you are not a directory that is required to install a Yum installed Php-devel

This will generate a configure configuration file for the current directory

3. Call configure to generate the makefile file, and then call make Yi to make install

As input:./configure--with-php-config=/usr/local/php534/bin/php-config

Return and enter Make&make install

Enter will generate a curl.so file

Things are not smooth sailing, and indeed, in addition to a moth, prompted an error, do not be afraid to make a clean execution, and then continue

As input:./configure--with-php-config=/usr/local/php534/bin/php-config

Return and enter Make&make install

OK done, generated a curl.so file, dream of AH.

Next is the CP curl.so/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/(this path, everyone's not the same ha but the front must be the same)

Copy the curl.so file in the PHP extension directory (you can view the extension directory in the php.ini file, you can also print the Phpinf () function to view the PHP extension installation directory), in the php.ini file to add

Modify the extension library directory Extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20100525/" (You can view the extended directory by looking in the php.ini file. You can also print the Phpinf () function to see the PHP Extension installation directory);

Add curl Extension Extension = curl.so

The result is an error.

Hey, poor people.

Liunx How to configure PHP curl to expand the library

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.