php5添加pdo_mysql擴展

在安裝一個禪道項目管理軟件時,須要的條件有一條是php支持pdo_mysql擴展,因爲服務器上還運行有其餘系統,以前安裝php在編譯時候沒有指定須要支持這個擴展,全部須要手動添加支持。
使用命令查看當前php已經支持的擴展/usr/local/php/bin/php -m,結果
[root@host03 pdo_mysql]# /usr/local/php/bin/php -m
[PHP Modules]
Core
ctype
curl
date
dba
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysql
mysqli
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
SQLite
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlibphp

[Zend Modules]
進入到php源碼包內找到擴展文件所在地目錄/home/php-5.3.8/ext/pdo_mysql,源碼安裝包ext目錄下是全部擴展到文件目錄。
執行/usr/local/php/bin/phpize在擴展到目錄下,生成編譯須要的文件
而後再執行./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql-config=/usr/bin/mysql_config
再而後就是make了,make完成後,若是執行make test報錯,SKIP PECL Bug #7976 (Calling stored procedure several times) [tests/bug_pecl_7976.phpt] reason: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)
PHP Warning: opendir(ext/pdo/tests): failed to open dir: No such file or directory in /home/php-5.3.8/ext/pdo_mysql/run-tests.php on line 853
ERROR: cannot open directory: ext/pdo/tests
直接無視,執行make install
完成後編輯php.ini把新生成的庫文件添加進去,在擴展到下面添加extension=pdo_mysql.so,這個機器上庫文件的路徑是/usr /local/php/lib/php/extensions/no-debug-non-zts-20090626,也能夠寫絕對路徑
再查看php支持的擴展。[root@host03 ~]# /usr/local/php/bin/php -m
[PHP Modules]
Core
ctype
curl
date
dba
dom
ereg
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysql
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
SQLite
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlibmysql

[Zend Modules]sql

pdo_mysql已經存在了json

相關文章
相關標籤/搜索