关于php插件pdo_mysql的安装

时间:2022-09-19 14:37:35

今天在做一个商城的连接的时候,需要MpDO验证。需要安装pdo_mysql模块,刚开始按照php扩展模块的安装按照这个安装ZIP,curl都成功了但是安装pdo_mysql却不行,在./configure --with-php-config=/usr/local/php/bin/php-config是出现错误。如下

checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for MySQL support for PDO... yes, shared checking for the location of libz... no checking for mysql_config... not found configure: error: Unable to find your mysql installation 找不到mysql

最后终于找到了解决办法:

这样来编译:./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql 就可以了,之后按照这php扩展模块安装个来做即可

php编译安装转自:http://www.apelearn.com/bbs/forum.php?mod=viewthread&tid=11526&highlight=php%C0%A9%D5%B9%C4%A3%BF%E9

扩展模块编译安装
/usr/local/php/bin/php -m
进入php源码包目录 /usr/local/src/php-5.4.36
cd  ext/
以curl为例
/usr/local/php/bin/php -m |grep -i curl
cd /curl/
ls
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/curl.so
/usr/local/php/bin/php -i |grep extension_dir
vim /usr/local/php/etc/php.ini
extension=php_shmop.dll(该行下面添加如下信息)
extension=curl.so
保存退出
:nohl取消高亮(vim界面)
grep 'extension=' /usr/local/php/etc/php.ini (查看安装动态的模块)