如果启动apache 报错:
[root@localhost lib]# /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 61 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_encoding.so into server: libiconv_hook.so.1: cannot open shared object file: No such file or directory
就要:
shell> vi /etc/ld.so.conf
加入:
/usr/local/lib
shell> ldconfig //让路径起作用
如果重新起动APACHE出现:
Syntax error . line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解决:
1.chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so
------------------------------
如果启动apache 报错:
[root@localhost httpd]# cd /usr/local/apache2/bin/ [root@localhost bin]# ./apachectl start httpd: Syntax error on line 55 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: libmysqlclient.so.15: cannot open shared object file: No such file or directory 解决办法:让所有库自动给连5.0.84的client lib ln -s /usr/local/mysql/lib/libmysqlclient.so.15 libmysqlclient.so.15 启动 apachectl 时出错,说httpd.conf的53行有语法错误.libphp5.so模块无法载入. Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Can not load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: Can't restore segment prot after reloc : Permission denied 解决: apache不能加载外挂php模块这是由SELinux的安全策略配置不当引起的.在Fedora Core 的官方网站上有相关的Apache/SELinux的策略调整文档.如果嫌麻烦,可以直接修改/etc/selinux/config 将SELinux禁用. Syntax error on line 79 of /usr/local/httpd/conf/httpd.conf: AddType requires at least two arguments,a mime type followed by one or more file extensions 启动 httpd:httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/auth_mysql.conf: Cannot load /etc/httpd/modules/mod_auth_mysql.so into server: libmysqlclient.so.15: cannot open shared object file: No such file or directory 解决:看见上面的原因可能是我之前卸载rhel自带的mysql的过程中,强制卸载了一些依赖包,解决办法如下: vi /etc/httpd/conf.d/auth_mysql.conf //进入相关文件,注释掉出错的第六行,解决OK 在设置的DocumentRoot目录下,添加一个phpinfo.php的文件来测试系统,程序代码如下: 这时候在客户端浏览器中访问http://localhost/phpinfo.php应该出现php的参数表,至此所有系统安装完毕。 4 测试时发现不能解析php,具体表现为页面空白,但可以解析html(就是能出来apache刚安装好后的提示那个) ?后少加了后缀php。这是php.ini没有设置好的原因 ; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized. ; NOTE: Using short tags should be avoided when developing applications or ; libraries that are meant for redistribution, or deployment on PHP ; servers which are not under your control, because short tags may not ; be supported on the target server. For portable, redistributable code, ; be sure not to use short tags. ************************************************************************************************** Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/usr/local/httpd/htdocs/phpinfo.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0 问题的原因是 : 你的phpinfo.php文件 在这个用户下不具有 可读的权限 通过 ls -l 查看 文件的权限 然后更改权限(添加读权限 chmod +r phpinfo.php)就不会出现这个问题了... ----------------------------------------------- /usr/local/apache2/bin/apachectl restart httpd: Syntax error on line 55 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied chcon -t textrel_shlib_t /usr/local/apache2/modules/*.so 把文件中的SELINUX="enforcing" 改为 disabled ----------------------------------------------------- ------------------------------------------------ 启动 apachectl 时出错 , 说 httpd.conf 的 53 行有语法错误 .libphp5.so 模块无法载入 . Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Can not load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: Can't restore segment prot after reloc : Permission denied 解决 : apache 不能加载外挂 php 模块这是由 SELinux 的安全策略配置不当引起的 . 在 Fedora Core 的官方网站上有相关的 Apache/SELinux 的策略调整文档 . 如果嫌麻烦 , 可以直接修改 /etc/selinux/config 将 SELinux 禁用 . ------------------------------------------------------------------- Syntax error on line 79 of /usr/local/httpd/conf/httpd.conf: AddType requires at least two arguments,a mime type followed by one or more file extensions ---------------------------------------------------------------------- 启动 httpd : httpd: Syntax error on line 210 of /etc/httpd/conf/httpd.conf: Syntax error on line 6 of /etc/httpd/conf.d/auth_mysql.conf: Cannot load /etc/httpd/modules/mod_auth_mysql.so into server: libmysqlclient.so.15: cannot open shared object file: No such file or directory 解决:看见上面的原因可能是我之前卸载rhel自带的mysql的过程中,强制卸载了一些依赖包,解决办法如下: vi /etc/httpd/conf.d/auth_mysql.conf // 进入相关文件,注释掉出错的第六行,解决 OK 在设置的DocumentRoot目录下,添加一个phpinfo.php的文件来测试系统,程序代码如下: 这时候在客户端浏览器中访问http://localhost/phpinfo.php应该出现php的参数表,至此所有系统安装完毕。 ----------------------------------------------------------- 测试时发现不能解析php,具体表现为页面空白,但可以解析html(就是能出来apache刚安装好后的提示那个) ?后少加了后缀php。这是php.ini没有设置好的原因 ; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized. ; NOTE: Using short tags should be avoided when developing applications or ; libraries that are meant for redistribution, or deployment on PHP ; servers which are not under your control, because short tags may not ; be supported on the target server. For portable, redistributable code, ; be sure not to use short tags. ************************************************************************************************** Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error: Unknown: Failed opening required '/usr/local/httpd/htdocs/phpinfo.php' (include_path='.:/usr/local/lib/php') in Unknown on line 0 问题的原因是 : 你的 phpinfo.php 文件 在这个用户下不具有 可读的权限 通过 ls -l 查看 文件的权限 然后更改权限(添加读权限 chmod +r phpinfo.php )就不会出现这个问题了 ...