CentOs环境下PHP支持PDO_MYSQL
一、下載相應tgz包;
?http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
二、安裝開始
解壓
# tar zxvf PDO_MYSQL-1.0.2.tgz?
# cd PDO_MYSQL-1.0.2
運行命令
# /usr/local/php/bin/phpize?
Configuring for:
PHP Api Version:???????? 20121212
Zend Module Api No:????? 20060613
Zend Extension Api No:?? 220060519
?
如果運行/usr/local/php/bin/phpize?出現Cannot find autoconf. Please check your autoconf installation and the?
$PHP_AUTOCONF environment variable. Then, rerun this script.?那么說明沒有autoconf
?
那么執行命令?yum install?m4??
????? ?????????? yum install autoconf
?
配置
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
如果配置
如果執行時報錯
configure: warning: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for MySQL support for PDO... yes, shared
checking for mysql_config... not found
configure: error: Cannot find MySQL header files under?
解決辦法:
cp /usr/local/mysql/bin/mysql_config /usr/bin
?
編譯
如果執行時報錯
/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19: error: mysql.h: No such file or directory
In file included from /software/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36: error: expected specifier-qualifier-list before 'MYSQL'
/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48: error: expected specifier-qualifier-list before 'MYSQL_FIELD'
/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:53: error: expected specifier-qualifier-list before 'MYSQL_RES'
make: *** [pdo_mysql.lo] Error 1
解決辦法:
yum install mysql-devel
如果執行yum install mysql-devel錯誤仍然存在,那么執行如下操作
這是因為在編譯時需要mysql的頭的文件,而它按默認搜索找不到頭文件的位置,所以才出現這個問題.所以要將 /usr/local/mysql/include/ 目錄下的mysql頭文件鏈接到 /usr/local/include/ 的目錄下:
ln -s /usr/local/mysql/include/* /usr/local/include/
?
一般來說,執行完上面的命令后,應該能編譯過去 。然后再make和make install,pdo_mysql模塊加進去了
三、修改php.ini;?
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20121212/"(no-debug-zts-20121212 該路徑名根據自己的實際情況設置)
extension = "pdo_mysql.so"
自此,PDO_MYSQL安裝完成。
?
http://blog.csdn.net/blueg2013/article/details/9307767
轉載于:https://www.cnblogs.com/walter371/p/4531828.html
總結
以上是生活随笔為你收集整理的CentOs环境下PHP支持PDO_MYSQL的全部內容,希望文章能夠幫你解決所遇到的問題。