您好,登錄后才能下訂單哦!
1、查看模塊是否安裝并進入php模塊的安裝目錄
[root@daixuan ext]# /usr/local/php/bin/php -m | grep -i curl
[root@daixuan ext]# pwd
/usr/local/src/php-5.4.45/ext
[root@daixuan ext]# ls 所有的模塊都是可以安裝的,部分已經安裝
curl mssql pdo_oci simplexml tokenizer
gettext mysql pdo_odbc skeleton
date gmp mysqli wddx
[root@daixuan ext]# cd curl
[root@daixuan curl]# ls
config.m4 CREDITS interface.c package.xml streams.c
config.w32 curl.dsp multi.c php_curl.h tests
2、生成curl的模塊configure可執行文件
[root@daixuan curl]# /usr/local/php/bin/phpize 生成configure可執行文件
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
[root@daixuan curl]# ls
acinclude.m4 config.h.in config.w32 ltmain.sh package.xml
aclocal.m4 config.m4 CREDITS Makefile.global php_curl.h
autom4te.cache config.sub curl.dsp missing run-tests.php
build configure install-sh mkinstalldirs streams.c
config.guess configure.in interface.c multi.c tests
3、配置編譯參數(如果有錯,可能是缺少庫)
[root@daixuan curl]# ./configure --with-php-config=/usr/local/php/bin/php-config
4、編譯
[root@daixuan curl]# make
Build complete.
Don't forget to run 'make test'.
5、安裝
[root@daixuan curl]# make install
Installing shared extensions:/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
[root@daixuan curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/
curl.so
6、配置PHP.ini添加curl.so模塊
[root@daixuan curl]# vim /usr/local/php/etc/php.ini
添加一行:extension=curl.so
[root@daixuan curl]# /usr/local/php/bin/php -m
[PHP Modules]
bz2
Core
ctype
curl 發現curl動態模塊已經加載
[root@daixuan curl]# vim vim /usr/local/php/logs/php_errors.log 如果不能加載,查看錯誤日志
[root@daixuan curl]# grep '^extension=' /usr/local/php/etc/php.ini 查看已經加載的動態模塊
extension=curl.so
知識點:extension.dir是存放擴展模塊的,在哪里呢?
[root@daixuan curl]# /usr/local/php/bin/php -i | grep extension.dir
extension_dir => /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525 => /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525
sqlite3.extension_dir => no value => no value
[root@daixuan curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525
curl.so
如果想修改extension.dir(擴展模塊的默認目錄),該怎么做呢?
[root@daixuan curl]# vim /usr/local/php/etc/php.ini
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "ext" 將其修改為指定的目錄
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。