以下的情况一般出现在php和mysql不装在一台机器上的情况。
yum安装的mysql如果提示缺少libclient.so.20,则把libclientmysql.so.20放到/usr/lib64/下。
ln -s /usr/lib/mysql /usr/lib64/mysql
其目的就是让/usr/lib64/下存在libclient.so.20
注意:要保证/etc/ld.so.conf.d/mysql-x86_64.conf文件中存在/usr/lib64/mysql
编译安装的mysql缺少libclient.so.20,则:
cp /usr/local/mysql/lib/libmysqlclient.so.20 /usr/lib64/
###############################################
默认的插件在/usr/local/php/lib/php/extension/no*
编辑php.ini把php插件统一放到extension目录:
vi /usr/local/php/lib/php.ini extension_dir = "/usr/local/php/lib/php/extensions"
安装pdo扩展:
#进入到php的安装包目录: cd php-5.6.30 cd ext/pdo /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --enable-pdo=shared make && make install cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/pdo.so /usr/local/php/lib/php/extensions/
安装pdo_mysql扩展:
wget 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 #生成configure文件 ./configure -with-php-config=/usr/local/php/bin/php-config -with-pdo-mysql=/usr/local/mysql ln -s /usr/local/mysql/include/* /usr/local/include/ makemake install 拷贝生成的文件: cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql.so /usr/local/php/lib/php/extensions/ 编辑配置文件php.ini extension=pdo_mysql.so
安装php-mysql扩展:
cd php-5.6.30/ext/mysql
/usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config --with-mysql=/usr/local/mysql make && make install 拷贝生成的文件: cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/mysql.so /usr/local/php/lib/php/extensions/ 编辑配置文件: extension=mysql.so
时间: 2024-10-12 16:17:13