编译安装php时 出现的问题总结
2016-10-26 18:18
671 查看
因为我是使用的编译安装,服务器没有外网。记录一下编译安装的可能会出现问题的
php-5.3.29 +mysql5.1.71
1、安装mysql.so 通过phpinfo 页面 发现无法加载so,查看httpd的error日志发现
failed to map segment from shared object: Permission denied in
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so' - /etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so: failed to map segment from shared object: Permission
denied in <b>Unknown</b> on line <b>0</b><br />
解决方法:
chcon -R -h -t httpd_sys_script_exec_t /etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so
2、编译mysql.so的时候 发现
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers
这不是一个告警 ,必须重新安装re2c 0.13.4 或者更高版本才可以
解决方法:
tar zxf re2c-0.13.5.tar.gz && cd re2c-0.13.5
./configure
make && make install
3、访问thinkphp首页 _STORAGE_WRITE_ERROR_:./Application/Runtime/Cache/User/788524be80db1959c132efbce25367a0.php
或
访问首页时 显示 Application/Runtime 不可编辑
解决方法:
rm -rf Runtime/*
chmod 777 %项目目录%
4、 编译安装pdo_msyql.so的时候
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
64位的系统,libmysqlclient.so默认安装在/user/lib64/mysql 但是安装的时候 会去找/user/lib/mysql
解决方法:
先查看一下libmysqlclient.so 目录
find / -name libmysqlclient.so
可以增加软链解决;
ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so
5、 Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'
需要编译安装mysql.so pdo_mysql
进行php源代码的ext中
/etc/httpd/php/bin/phpize --/etc/httpd/php/bin 为php的bin目录
.configure
make && make install
然后需在php.ini中增加对应的配置
extension_dir = "/etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension="pdo_mysql.so"
extension="mysql.so"
6. configure时 Cannot find config.m4.
Make sure that you run '/home/zhuyx/local/php-5.5.3/bin/phpize' in the top level source directory of the module
phpize扩展安装,源包需要有config.m4这个配置文件
解决方法:
比较粗暴的时 可以看下将config0.m4 将这个文件改成config.m4
mv config0.m4 config.m4
7 安装后 发现thinkphp 提示
SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX' (13)
解决方法:
getsebool -a | grep httpd
找到一个 httpd_can_network_connect --> off
修改这个值
#setsebool httpd_can_network_connect 1
8.编译 mysql.so时
configure: error: Try adding --with-zlib-dir=
. Please check config.log for more information.
解决方法:
编译时configure 带上参数 --with-zlib-dir
9、访问时 HTTP 错误 403 - 禁止访问,即403 Forbidden:You don't have permission to access / on this server.
需要检查
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
由于配置了php后,此处“Deny from all”为拒绝一切连接。
把此行修改为 “Allow from all”,即可解决问题。
安装时候 由于把Root指定了目录,建议安装时默认的目录
DocumentRoot "/var/www/html/"
php-5.3.29 +mysql5.1.71
1、安装mysql.so 通过phpinfo 页面 发现无法加载so,查看httpd的error日志发现
failed to map segment from shared object: Permission denied in
<b>Warning</b>: PHP Startup: Unable to load dynamic library '/etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so' - /etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so: failed to map segment from shared object: Permission
denied in <b>Unknown</b> on line <b>0</b><br />
解决方法:
chcon -R -h -t httpd_sys_script_exec_t /etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/mysql.so
2、编译mysql.so的时候 发现
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers
这不是一个告警 ,必须重新安装re2c 0.13.4 或者更高版本才可以
解决方法:
tar zxf re2c-0.13.5.tar.gz && cd re2c-0.13.5
./configure
make && make install
3、访问thinkphp首页 _STORAGE_WRITE_ERROR_:./Application/Runtime/Cache/User/788524be80db1959c132efbce25367a0.php
或
访问首页时 显示 Application/Runtime 不可编辑
解决方法:
rm -rf Runtime/*
chmod 777 %项目目录%
4、 编译安装pdo_msyql.so的时候
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock
configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!
64位的系统,libmysqlclient.so默认安装在/user/lib64/mysql 但是安装的时候 会去找/user/lib/mysql
解决方法:
先查看一下libmysqlclient.so 目录
find / -name libmysqlclient.so
可以增加软链解决;
ln -s /usr/lib64/mysql/libmysqlclient.so /usr/lib/libmysqlclient.so
5、 Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'
需要编译安装mysql.so pdo_mysql
进行php源代码的ext中
/etc/httpd/php/bin/phpize --/etc/httpd/php/bin 为php的bin目录
.configure
make && make install
然后需在php.ini中增加对应的配置
extension_dir = "/etc/httpd/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension="pdo_mysql.so"
extension="mysql.so"
6. configure时 Cannot find config.m4.
Make sure that you run '/home/zhuyx/local/php-5.5.3/bin/phpize' in the top level source directory of the module
phpize扩展安装,源包需要有config.m4这个配置文件
解决方法:
比较粗暴的时 可以看下将config0.m4 将这个文件改成config.m4
mv config0.m4 config.m4
7 安装后 发现thinkphp 提示
SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX' (13)
解决方法:
getsebool -a | grep httpd
找到一个 httpd_can_network_connect --> off
修改这个值
#setsebool httpd_can_network_connect 1
8.编译 mysql.so时
configure: error: Try adding --with-zlib-dir=
. Please check config.log for more information.
解决方法:
编译时configure 带上参数 --with-zlib-dir
9、访问时 HTTP 错误 403 - 禁止访问,即403 Forbidden:You don't have permission to access / on this server.
需要检查
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
由于配置了php后,此处“Deny from all”为拒绝一切连接。
把此行修改为 “Allow from all”,即可解决问题。
安装时候 由于把Root指定了目录,建议安装时默认的目录
DocumentRoot "/var/www/html/"
相关文章推荐
- 关于PHP一些编译安装出现的错误总结
- 转 解决在X64 RedHat5.1 下以编译方式安装PHP 出现的种种问题
- 奋斗数天!解决在X64 RedHat5.1 下以编译方式安装PHP 出现的种种问题
- 有关编译安装php和php-fpm时出现的问题
- 编译安装php-5.6.19出现的问题configure: error: mysql configure failed. Please check config.log
- php 编译安装curl 时候出现问题
- LNMP之编译安装PHP出现的问题
- 在X64 RedHat5 或者 RedHat4 下编译安装PHP出现的各种问题及解决
- 编译安装php容易出现的问题以及解决办法
- Linux 安装编译PHP出现的问题及解决方法
- 解决在X64 RedHat5.1、centos、linux 下以编译方式安装PHP 出现的种种问题(转)
- LNMP之编译安装PHP出现的问题
- mac下php7.0.9的编译安装及问题处理总结
- LNMP之编译安装PHP出现的问题
- 编译安装PHP5.6并解决PHP出现下载页面问题
- linux下php安装及连接oracle遇到问题总结
- MAC OS下Qt SDK1.2安装后出现g++-4.2问题无法编译
- PHP 5.3.10 编译安装时出现 undefined reference to `libiconv' 错误的解决方法
- PHP安装问题总结
- oracle11g安装出现TNS:协议适配器错误问题相关整理总结