Add PHP extension methods under Linux and Windows

Source: Internet
Author: User
Tags php source code phpinfo

This compilation only compiles PHP's extension library Separately, then adds the compiled PHP extension library to the now running PHP, does not recompile the PHP which is running now, therefore has no effect to the PHP running now.

If the originally compiled PHP directory under the/usr/local/php directory, Apache in the/usr/local/apache2 directory; PHP source code in the/usr/local/src/php-5.2.14 directory. If the actual directory is inconsistent with the assumed directory, make the adjustment in the following command.

1. Locate the source code directory for the currently running PHP version, such as php-5.2.14. Enter the Curl Extension Library directory.
$CD/usr/local/src/php-5.2.14/ext/curl

2. Call the Phpize program to generate the compilation configuration file.
$/usr/local/php/bin/phpize

3. Compile the extension library and perform the following configure and make commands, respectively.
$./configure-with-php-config=/usr/local/php/bin/php-config
# #configure这一步执行通过后, then execute the Make command, and if configure does not pass, find the cause of the error.
$make
# #make成功执行后, the resulting extension library file is in the modules subdirectory of the current directory,
such as/usr/local/src/php-5.2.14/ext/curl/modules/curl.so

4. Configuring the php.ini File
# #将编译好的扩展库文件复制到apache2 the Modules directory.
$CP/usr/local/src/php-5.2.14/ext/curl/modules/curl.so/usr/local/apache2/modules/.
# #可以通过查看phpinfo信息来确定php the. ini file location, and then edit.
# Locate the Settings extension directory #在php the. ini file, and then set the extension path to the Apache2 modules directory.
Extension_dir = "/usr/local/apache2/modules/"
# #在php The Add Extension library location for. INI, set the extension library to be added.
Extension=curl.so
# #以后如果还要添加别的扩展库的话, just compile the PHP extension library first and copy it to the Apache2 modules directory.
# #然后再在这个位置, add a row to append the compiled extension library file name.

5. Restart Apache and view the Phpinfo information to see the Curl Extension library you just added.

Add Curl under Windows:

The following settings allow PHP to support the Curl Extension library.

1, modify the php.ini, Extension=php_curl.dll this line before the comments removed.

2, the PHP installation directory under the Libeay32.dll, ssleay32.dll two files copied to the C:\Windows directory.

3. Restart Apache.

Now look at the phpinfo, there should be curl function.

Add PHP extension methods under Linux and Windows

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.