CentOs环境下PHP支持PDO_MYSQL
一、下載相應(yīng)tgz包;
?http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
二、安裝開(kāi)始
解壓
# tar zxvf PDO_MYSQL-1.0.2.tgz?
# cd PDO_MYSQL-1.0.2
運(yùn)行命令
# /usr/local/php/bin/phpize?
Configuring for:
PHP Api Version:???????? 20121212
Zend Module Api No:????? 20060613
Zend Extension Api No:?? 220060519
?
如果運(yùn)行/usr/local/php/bin/phpize?出現(xiàn)Cannot find autoconf. Please check your autoconf installation and the?
$PHP_AUTOCONF environment variable. Then, rerun this script.?那么說(shuō)明沒(méi)有autoconf
?
那么執(zhí)行命令?yum install?m4??
????? ?????????? yum install autoconf
?
配置
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql
如果配置
如果執(zhí)行時(shí)報(bào)錯(cuò)
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
?
編譯
如果執(zhí)行時(shí)報(bào)錯(cuò)
/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
如果執(zhí)行yum install mysql-devel錯(cuò)誤仍然存在,那么執(zhí)行如下操作
這是因?yàn)樵诰幾g時(shí)需要mysql的頭的文件,而它按默認(rèn)搜索找不到頭文件的位置,所以才出現(xiàn)這個(gè)問(wèn)題.所以要將 /usr/local/mysql/include/ 目錄下的mysql頭文件鏈接到 /usr/local/include/ 的目錄下:
ln -s /usr/local/mysql/include/* /usr/local/include/
?
一般來(lái)說(shuō),執(zhí)行完上面的命令后,應(yīng)該能編譯過(guò)去 。然后再make和make install,pdo_mysql模塊加進(jìn)去了
三、修改php.ini;?
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20121212/"(no-debug-zts-20121212 該路徑名根據(jù)自己的實(shí)際情況設(shè)置)
extension = "pdo_mysql.so"
自此,PDO_MYSQL安裝完成。
?
http://blog.csdn.net/blueg2013/article/details/9307767
轉(zhuǎn)載于:https://www.cnblogs.com/walter371/p/4531828.html
總結(jié)
以上是生活随笔為你收集整理的CentOs环境下PHP支持PDO_MYSQL的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 带裹的网名83个
- 下一篇: Mysql 重做日志及与二进制日志的区别