/*------------------------------------------------------------------------ 写在前面: 我看到很多网友的提问都跟服务器配置有关,搭建一个可靠而又安全的应用开发服务器是WEB编程的基础,尤其对于在LINUX上进行JSP开发的朋友而言。 
这篇文档是我多年服务器配置的结晶,发表前已历经本人N此修改(最后一次大的修改是在RH7.2刚刚发布之即,而后一来由于忙于开发二来由于没有发现错误,所以没有升级),文档 
于2001年底被天极网转载(http://www.yesky.com/20020206/217592.shtml),后经linuxbye.net,cnjsp.com等多个linux和JAVA社区转载,历经时间考验,至今未曾发现错误,各位尽可 
放心使用。 
文档在web页面的显示效果不够理想,如果您希望得到本文档的PDF,或有任何意见建议,可邮件至[email protected] 
文档较长,分为多篇发布,这是第八篇,以下为正文: -----------------------------------------------------------------------*/ 
  
  
例四:测试PHP
1 创建源文件
touch /home/www/test.php 
chmod 701 /home/www/test.php 
  
2 编辑源文件
vi test.php  
## 源代码如下: 
<? 
phpinfo();  
?>  
  
3 测试该程序
lynx http://www.yesgo.loc/test.php  
//结果是大家熟知的服务器端变量列表。 
-------------------------------------------------------------------------------------------- 
  
##调试过程可能的错误如下: 
  
常见错误一:You don't have permission
Forbidden 
You don't have permission to access / on this server.  
 
 
Apache/1.3.22 Server at www.yesgo.loc Port 80
  
原因可能是: 
1、 你没有为该目录或者该文件设置guest组权限; 
2、 你没有将该文件名设置为默认页面,尤其是在仅用域名访问的情况下。 
解决办法: 
chmod 701 /home/www 
DirectoryIndex index.html index.jsp index.xtp index.php index.php3 
  
常见错误二:404 Not Found
404 Not Found /index.jsp was not found on this server.  
 
 
Resin 2.0.5 (built Thu Nov 15 17:56:24 PST 2001) 
  
原因可能是: 
1、 你请求的文件名输入错误; 
2、 你没有在resin.conf和httpd.conf中都建立相应的主机。 
解决办法: 
1、 检查文件名,尤其注意大小写问题; 
2、 参照Resin install步骤中的配置支持JSP的虚拟主机部分。 
  
常见错误三:java.lang.ClassNotFoundException
500 Servlet Exception java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver                     at com.caucho.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:479)                     at java.lang.ClassLoader.loadClass(ClassLoader.java:253)                     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)                     at java.lang.Class.forName0(Native Method)                     at java.lang.Class.forName(Class.java:120)                     at _cnmysql__jsp._jspService(/cnmysql.jsp:4)                     at com.caucho.jsp.JavaPage.service(JavaPage.java:74)                     at com.caucho.jsp.Page.subservice(Page.java:485)                     at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)                     at com.caucho.server.http.Invocation.service(Invocation.java:278)                     at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)                     at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)                     at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)                     at com.caucho.server.TcpConnection.run(TcpConnection.java:140)                     at java.lang.Thread.run(Thread.java:484) 
 
 
Resin 2.0.5 (built Thu Nov 15 17:56:24 PST 2001) 
  
原因可能是: 
1、你没有安装驱动程序; 
2、驱动程序没有设置到系统CLASSPATH中。 
解决办法: 
参见 Classes Install 和 edit /etc/profile两部分 
  
常见错误四:Invalid authorization specification
500 Servlet Exception java.sql.SQLException: Invalid authorization specification: Access denied for user: '[email protected]' (Using password: YES)                     at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:330)                     at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)                     at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)                     at org.gjt.mm.mysql.Driver.connect(Driver.java:167)                     at java.sql.DriverManager.getConnection(DriverManager.java:517)                     at java.sql.DriverManager.getConnection(DriverManager.java:177)                     at _cnmysql__jsp._jspService(/cnmysql.jsp:5)                     at com.caucho.jsp.JavaPage.service(JavaPage.java:74)                     at com.caucho.jsp.Page.subservice(Page.java:485)                     at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:176)                     at com.caucho.server.http.Invocation.service(Invocation.java:278)                     at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:129)                     at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:338)                     at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:270)                     at com.caucho.server.TcpConnection.run(TcpConnection.java:140)                     at java.lang.Thread.run(Thread.java:484) 
 
 
Resin 2.0.5 (built Thu Nov 15 17:56:24 PST 2001) 
原因可能是: 
1、   源代码中的主机名、数据库名、帐号或者密码输入错误; 
2、   如果数据库名、帐号、密码均正确,那说明是主机名不匹配; 
3、   如果使用数据源连库,检查数据源的设置和源代码中名称是否输入正确。 
Solution: 
1、   参见Resin install和Server test两部分; 
注意:数据库的连接不仅仅是帐号和密码决定的,而是由主机名、数据库名、用户名和密码四个参数决定的。  
 
  |