编译php-fpm+mysql报无法找到头文件问题

mysql使用编译方式安装,使用用户mysql,主目录为/home/mysql,编译使用

./configure --prefix=/home/mysql 
--enable-thread-safe-client

在编译php-fpm时,使用

./configure \
--prefix=/home/nginx/php \
--enable-fastcgi \
--enable-fpm \
--with-mysql=/home/mysql \
--with-informix \
--with-zlib \
--with-curl \
--with-freetype-dir \
--enable-ftp \
--enable-zip \
--with-mcrypt \
--enable-mbstring \
--with-gd \
--enable-soap

时报以下错误:

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

网上查找相关信息,认为应当指定mysql的目录为mysql.h所在的目录,即/home/mysql/include/mysql。但使用--with-mysql=/home/mysql/include/mysql仍报同样的错误,于是陷入迷茫当中。。

刚偶然发觉,编译php使用的是其它用户,而不是mysql,而系统在创建mysql用户时,只给了mysql用户目录700权限! 于是尝试修改目录/home/mysql的权限为755,然后再尝试重新编译php-fpm,通过!

结论: 此次编译是虽然指定了php-fpm获取mysql的路径,但却缺少必要的访问权限,导致误认为是无法找到头文件。

标签: none

添加新评论

Free Web Hosting