安裝PHP需重裝MySql情況

本文介绍了在配置PHP过程中遇到的无法找到MySQL头文件的问题及其解决办法。通过卸载并重新安装MySQL相关软件包,以及安装MySQL客户端库,最终成功解决了配置问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

./configure --prefix=$HOME/local/webserver/php --with-config-file-path=$HOME/local/webserver/php/etc --with-mysql=/usr/local/mysql --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl-dir=/usr/bin/openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap

configure: error: Cannot find MySQL header files under /usr/share/mysql.
Note that the MySQL client library is not bundled anymore!

 

====== 解決辦法 ======


卸载mysql-server mysql-client
重装mysql-server mysql-clinet
sudo apt-get remove mysql-server mysql-client
sudo apt-get remove mysql-server-5.1 mysql-client-5.1
sudo apt-get installl mysql-server-5.1 mysql-client-5.1
安装完后,mysql正常工作,但配置php,仍然出错。
是不是包又安装错了?
说我少了mysql头文件,于是寻找whereis mysql
找到几个目录
mysql: /usr/bin/mysql /etc/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

sudo find / -name mysql.h
但没找到这个文件。不知道是哪出了问题。
又一个测试失败,继续。。。


######又来找其它办法来了######
安装一个mysql 的lib文件,命令如下:
sudo apt-get install libmysqlclient16 libmysqlclient16-dev

然后再./configure --prefix=/usr/local/php5.3.3 --enable-fpm --with-mysql=/usr/share/mysql --with-mysqli --with-openssl
OK
这次终于通过。然后就是
make&&make install

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值