tomcat運行php Xml代碼 tomcat安裝目錄下conf/web.xml把下邊這段代碼注釋去掉 cgi org.apache.catalina.servlets.CGIServlet debug 0 cgiPathPrefix WEB-INF/cgi passShellEnvironment true executable E:\Program Files\PHP\php-cgi.exe 5 cgi /cgi-bin/* tomcat安裝目錄下conf/web.xml把下邊這段代碼注釋去掉 cgi org.apache.catalina.servlets.CGIServlet debug 0 cgiPathPrefix WEB-INF/cgi passShellEnvironment true executable E:\Program Files\PHP\php-cgi.exe 5 cgi /cgi-bin/* Java代碼 伺服器啟動 會提示安全java.lang.安全Exception 說不能載入 org.apache.catalina.servlets.CGIServlet 到conf 下Context.xml改為下邊 WEB-INF/web.xml 伺服器啟動 會提示安全java.lang.安全Exception 說不能載入 org.apache.catalina.servlets.CGIServlet 到conf 下Context.xml改為下邊 WEB-INF/web.xml Java代碼 建立一個根據上邊web.xml配置的在你的工程/web-inf/ 建立一個cgi目錄,寫個 helloworld.php 運行瀏覽 http://localhost:8080/工程名/cgi-bin/hello.php 的時候 php-cgi自己的安全異常又報錯
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the http://php.net/security.cgi-bin ">manual page for CGI security.
For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit http://php.net/install.windows ">the manual page.
那個version.php裡這樣寫的:
This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.
For more information as to why this behaviour exists, see the http://php.net/security.cgi-bin ">manual page for CGI security.
For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit http://php.net/install.windows ">the manual page.
解決辦法 php.ini中 cgi.force_redirect = 1 改為 cgi.force_redirect=0 然後重啟伺服器運行就可以了。我測試了phpcms在tomcat運行情況,還行,有點慢 short_open_tag = On 還改了這,忘了因為什麼改成On了 short_open_tag規定了是否可以使用PHP代碼開始標誌的縮寫形式 就是 這種方式 我的目的是為了整合discuz 這是個discuz java 介面 http://code.google.com/p/discuz-ucenter-api-for-java/ php cms亂碼問題 http://bbs.phpcms.cn/viewthread.php?tid=110921 修改include/common.inc.php 檔案,找到如下代碼: if(GZIP && extension_loaded('zlib')) ini_set('zlib.output_compression', 'On'); 把 'On' 改成 'Off'