linux安装PHP扩展

首先找到php的源码安装包 php-7.2.5

补充: which mysql # 查询运行文件所在地址

进入到

cd /usr/local/src/php-7.2.5/ext/pdo-mysql

执行

/usr/local/php/bin/phpize 

然后

 ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr/local/mysql/ --with-zlib-dir=/usr/local/lib
# 如果报 configure: error: Unable to find your mysql installation
# 或者是 用于 yum 安装的 mysql
 ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr/ 

然后 make

下一步make install 

如果报

make: *** [pdo_mysql.lo] Error 1

则用

ln -s /usr/local/mysql/include/* /usr/local/include/

去解决

猜你喜欢

转载自blog.csdn.net/qq_36999656/article/details/81750804