Home  >  Article  >  Backend Development  >  Linux下PHP添加扩展库

Linux下PHP添加扩展库

WBOY
WBOYOriginal
2016-06-23 14:29:05906browse

一开始编译php的时候,忘了,现在用phpize安装扩展库进行添加
找到当前运行的php版本的源代码目录,如 php-5.2.12。进入curl扩展库目录
#cd /home/changyou/php-5.2.12/ext/curl
(调用phpize程序生成编译配置文件)
#/usr/local/web/php/bin/phpize
(编译扩展库,分别执行下面的configure和make命令)
#./configure ?with-php-config=/usr/local/web/php/bin/php-config
(configure这一步执行通过后,再执行make命令,如果configure执行不通过,则查找错误原因)
#make
make成功执行后,生成的扩展库文件在当前目录的 modules 子目录下
如我这里的目录是:/home/changyou/php-5.2.12/ext/curl/modules/curl.so
然后配置php.ini文件,将编译好的扩展库文件复制到php的extension目录下
#cp /home/changyou/php-5.2.12/ext/curl/modules/curl.so /usr/local/web/php/lib/php/extension/
最后修改 php.ini 添加配置
extension_dir = “/usr/local/web/php/lib/php/extension/”
extension=curl.so

Done!!!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn