在此處樓主遇到一個(gè)問題,用命令查看,居然不出現(xiàn)php 的模塊。
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來自于我們對(duì)這個(gè)行業(yè)的熱愛。我們立志把好的技術(shù)通過有效、簡(jiǎn)單的方式提供給客戶,將通過不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)、網(wǎng)站空間、營(yíng)銷軟件、網(wǎng)站建設(shè)、利津網(wǎng)站維護(hù)、網(wǎng)站推廣。
[root@OBird ~]# /usr/local/php/bin/php -m
于是進(jìn)行到目錄下這樣操作,才出現(xiàn),望解:
[root@OBird ~]# cd /usr/local/php/bin
[root@OBird bin]# ls
pear peardev pecl phar phar.phar php php-cgi php-config phpdbg phpize
[root@OBird bin]# php -m
[PHP Modules] # 此時(shí)靜態(tài)或動(dòng)態(tài)文件是看不出來的。動(dòng)態(tài)的是可以在 php.ini 里面去定義。
Core
ctype
date
dom
ereg
fileinfo
filter
hash
iconv
json
libxml
MySQLi
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
[Zend Modules]
有時(shí)候我們會(huì)發(fā)現(xiàn)有些模塊沒有編譯進(jìn)來,有兩種辦法,一是找到源碼包重編譯。二使用動(dòng)態(tài)的方式來加載。類似于apache 的動(dòng)態(tài)共享模塊。
下面我們就來用第二種方法,編譯一個(gè)動(dòng)態(tài)的共享模塊。
[root@OBird ~]# cd /usr/local/src/php-5.6.24 #進(jìn)到php 的源碼包
[root@OBird php-5.6.24]# ls
acinclude.m4 generated_lists Makefile.global README.MAILINGLIST_RULES server-tests-config.php
aclocal.m4 genfiles Makefile.objects README.md server-tests.php
build header makerpm README.namespaces snapshot
buildconf include missing README.NEW-OUTPUT-API stamp-h.in
buildconf.bat INSTALL mkinstalldirs README.PARAMETER_PARSING_API stub.c
CODING_STANDARDS install-sh modules README.redisT.BINS tests
config.guess libphp5.la netware README.RELEASE_PROCESS travis
config.log libs NEWS README.SELF-CONTAINED-EXTENSIONS TSRM
config.nice libtool pear README.STREAMS UPGRADING
config.status LICENSE php5.spec README.SUBMITTING_PATCH UPGRADING.INTERNALS
config.sub ltmain.sh php5.spec.in README.TESTING vcsclean
configure main php.gif README.TESTING2 win32
configure.in makedist php.ini-development README.UNIX-BUILD-SYSTEM Zend
CREDITS Makefile php.ini-production README.WIN32-BUILD-SYSTEM
ext Makefile.frag README.EXT_SKEL run-tests.php
EXTENSIONS Makefile.fragments README.GIT-RULES sapi
footer Makefile.gcov README.input_filter scripts
[root@OBird php-5.6.24]# cd ext/ # php 所有的塊都在這個(gè)目錄下
[root@OBird ext]# ls
bcmath dom ftp intl mysqli pdo pgsql shmop standard xml
bz2 enchant gd json mysqlnd pdo_dblib phar simplexml sybase_ct xmlreader
calendar ereg gettext ldap oci8 pdo_firebird posix skeleton sysvmsg xmlrpc
com_dotnet exif gmp libxml odbc pdo_mysql pspell snmp sysvsem xmlwriter
ctype ext_skel hash mbstring opcache pdo_oci readline soap sysvshm xsl
curl ext_skel_win32.php iconv mcrypt openssl pdo_odbc recode sockets tidy zip
date fileinfo imap mssql pcntl pdo_pgsql reflection spl tokenizer zlib
dba filter interbase mysql pcre pdo_sqlite session sqlite3 wddx
以 curl 為例進(jìn)行編譯:
[root@OBird ext]# /usr/local/php/bin/php -m |grep -i curl
[root@OBird ext]# cd curl/
[root@OBird curl]# ls
config.m4 config.w32 CREDITS curl.dsp curl_file.c interface.c multi.c package.xml php_curl.h share.c tests
[root@OBird curl]# /usr/l
lib/ lib64/ libexec/ local/
[root@OBird curl]# /usr/local/php/bin/phpize #生成configure 文件
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@OBird curl]# ls
acinclude.m4 build config.m4 configure.in curl.dsp interface.c missing package.xml share.c
aclocal.m4 config.guess config.sub config.w32 curl_file.c ltmain.sh mkinstalldirs php_curl.h tests
autom4te.cache config.h.in configure CREDITS install-sh Makefile.global multi.c run-tests.php
[root@OBird curl]# ./configure --with-php-config=/usr/local/php/bin/php-config
———————————————————————————————————————————————
樓主在編譯的過程中出現(xiàn)了報(bào)錯(cuò),那么就停下解決問題
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
[root@OBird curl]# cd /usr/local/src/
[root@OBird src]# wget https://github.com/skvadrik/re2c/releases/download/0.13.6/re2c-0.13.6.tar.gz
# tar xf re2c 0.13.4.tar.gz
# cd re2c 0.13.4
# ./configure
#make && make install
后面還是出錯(cuò)
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
在網(wǎng)上找到了解決辦法
今天配置一臺(tái)server的php支持curl的時(shí)候, 出現(xiàn)如下報(bào)錯(cuò)
checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
其實(shí)就是curl的dev包沒有安裝,
解決方案:
終端下
# yum -y install curl-devel
然后就可以繼續(xù)了
排錯(cuò)到此結(jié)束,繼續(xù)
———————————————————————————————————————————————
[root@OBird curl]# make install #/curl.so 模塊文件會(huì)被放在下面這個(gè)目錄
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/
[root@OBird curl]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so
/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl.so
extension_dir 是存放擴(kuò)展模塊的。 也是可以自定義的。
[root@OBird curl]# cd /usr/local/php/bin/
[root@OBird bin]# php -i |grep extension_dir
extension_dir => /usr/local/lib/php/extensions/no-debug-non-zts-20131226 => /usr/local/lib/php/extensions/no-debug-non-zts-20131226
sqlite3.extension_dir => no value => no value
[root@OBird ~]# cd /usr/local/php/bin
[root@OBird bin]# php -m # 此時(shí)是查看不到curl 這個(gè)模塊的。剛才在php.ini文件將模塊名寫錯(cuò)
來做測(cè)試 “curl1.so"
[root@OBird bin]# tail /usr/local/php/logs/php_errors.log
[02-Oct-2016 09:00:31 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl1.so' - /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/curl1.so: cannot open shared object file: No such file or directory in Unknown on line 0
[root@OBird bin]# vim /usr/local/php/etc/php.ini
extension=curl1.so # 修正
正常再重新加載就可以看到 curl這個(gè)模塊,但是樓主不知是哪里出錯(cuò)了,這個(gè)效果沒有做出來,但是curl 這個(gè)命令可以正常使用。只能先跳過去 了。
本文標(biāo)題:9_php擴(kuò)展模塊的安裝
URL鏈接:http://vcdvsql.cn/article34/gghise.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、軟件開發(fā)、網(wǎng)站策劃、Google、移動(dòng)網(wǎng)站建設(shè)、網(wǎng)站制作
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)