mod_auth_mysql.c:269:10: fatal error: mysql.h: No such file or directory

阿里云服务器搭建云上博客的时候:
输入指令:

yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql

报错:
No match for argument: mod_auth_mysql
Error: Unable to find a match: mod_auth_mysql

想着mod_auth_mysql应该是没有安装,就各种搜索找到了下面的文章:

CentOS 7下httpd-2.4.6的mod_auth_mysql安装及配置
但是在修改源码之后编译时报错:
mod_auth_mysql.c:269:10: fatal error: mysql.h: No such file or directory #include
compilation terminated.
apxs:Error: Command failed with rc=65536

解决方案:

安装mysql-devel:yum install mysql-devel

如果出现如下错误:
Cannot download file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql: All mirrors were tried
The downloaded packages were saved in cache until the next successful transaction.

参考https://blog.csdn.net/chongji1262/article/details/100735271
没有的话就继续
重新编译就会解决

如果出现错误:
/usr/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536

安装zlib:yum install zlib-devel

按照第一篇文章重新编译:apxs -c -L/usr/lib64/mysql -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c即可

但是
重新输入指令yum -y install httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
还是会报No match for argument: mod_auth_mysql
Error: Unable to find a match: mod_auth_mysql
,也不知道为啥,更新了yum源之后也没有用欢迎大佬指点。

安装php-imap的时候出现
No match for argument: php-imap
Error: Unable to find a match: php-imap

出现No match for argument问题的时候:可能是yum源没有更新,要更新yum源,再进行安装
centOS8:

rm -rf /etc/yum.repos.d/Centos-Base.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
yum makecache

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

更新后重新安装即可

你可能感兴趣的:(服务器,centos,mysql)