如果启动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 
 
cd /usr/lib
ln -s /usr/local/mysql/lib/libmysqlclient.so.15 libmysqlclient.so.15
ll | grep mysqls
   
(1)
启动 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禁用.
(2)
 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
解决:要加空格
(3)
启动 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的文件来测试系统,程序代码如下:
<?
//filename: phpinfo.php
phpinfo();
?>
这时候在客户端浏览器中访问http://localhost/phpinfo.php应该出现php的参数表,至此所有系统安装完毕。
 
4 测试时发现不能解析php,具体表现为页面空白,但可以解析html(就是能出来apache刚安装好后的提示那个)
解决:<?php
phpinfo();
?>
?后少加了后缀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.
short_open_tag = Off
把这个设置为ON也可以解决。。。。。。
 
**************************************************************************************************
 
再个问题就是:浏览器显示错误信息如下:
 
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)就不会出现这个问题了...
如果看到如图1的信息即表示成功了
-----------------------------------------------
/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:
vi /etc/selinux/config
   把文件中的SELINUX="enforcing" 改为 disabled
setenforce 0   让selinux生效
-----------------------------------------------------
如果出错::::::
------------------------------------------------
 
启动 apachectl 时出错,httpd.conf53行有语法错误.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
解决:要加空格
 
----------------------------------------------------------------------
 
启动 httpdhttpd: 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的文件来测试系统,程序代码如下:
 
<?
 
//filename: phpinfo.php
 
phpinfo();
 
?>
这时候在客户端浏览器中访问http://localhost/phpinfo.php应该出现php的参数表,至此所有系统安装完毕。
 
-----------------------------------------------------------
打开php测试页报错显示空白
测试时发现不能解析php,具体表现为页面空白,但可以解析html(就是能出来apache刚安装好后的提示那个)
 
解决:<?php
 
phpinfo();
 
?>
?后少加了后缀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.
 
short_open_tag = Off
把这个设置为ON也可以解决。。。。。。
  
**************************************************************************************************
 
再个问题就是:浏览器显示错误信息如下:
  
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)就不会出现这个问题了...
如果看到如图1的信息即表示成功了