1. Locate the source code directory for the currently running PHP version, such as php-4.4.7. Enter the Curl Extension Library directory.
$CD/home/php-4.4.7/ext/curl
2. Call the Phpize program to generate the compilation configuration file.
$/usr/local/php4/bin/phpize
3. Compile the extension library and perform the following configure and make commands, respectively.
$./configure-with-php-config=/usr/local/php4/bin/php-config
# #configure这一步执行通过后, then execute the Make command, and if configure does not pass, find the cause of the error.
$make && make Install
# #make成功执行后, the resulting extension library file is in the modules subdirectory of the current directory,
such as/home/php-4.4.7/ext/curl/modules/curl.so
4. Configuring the php.ini File
# #将编译好的扩展库文件复制到apache2 the Modules directory. (Customizable directory)
$CP/home/php-4.4.7/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 extensions to PHP dynamically