1、查看模塊是否安裝并進入php模塊的安裝目錄
創(chuàng)新互聯(lián)建站基于成都重慶香港及美國等地區(qū)分布式IDC機房數(shù)據(jù)中心構(gòu)建的電信大帶寬,聯(lián)通大帶寬,移動大帶寬,多線BGP大帶寬租用,是為眾多客戶提供專業(yè)服務(wù)器托管報價,主機托管價格性價比高,為金融證券行業(yè)成都棕樹電信機房,ai人工智能服務(wù)器托管提供bgp線路100M獨享,G口帶寬及機柜租用的專業(yè)成都idc公司。
[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 所有的模塊都是可以安裝的,部分已經(jīng)安裝
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可執(zhí)行文件
[root@daixuan curl]# /usr/local/php/bin/phpize 生成configure可執(zhí)行文件
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、配置編譯參數(shù)(如果有錯,可能是缺少庫)
[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 發(fā)現(xiàn)curl動態(tài)模塊已經(jīng)加載
[root@daixuan curl]# vim vim /usr/local/php/logs/php_errors.log 如果不能加載,查看錯誤日志
[root@daixuan curl]# grep '^extension=' /usr/local/php/etc/php.ini 查看已經(jīng)加載的動態(tài)模塊
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(擴展模塊的默認(rèn)目錄),該怎么做呢?
[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" 將其修改為指定的目錄