Bug #74773 [Opn]: Wrong SCRIPT_NAME with Tomcat and CGIServlet

From: Date: Sat, 17 Jun 2017 14:29:28 +0000
Subject: Bug #74773 [Opn]: Wrong SCRIPT_NAME with Tomcat and CGIServlet
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209565@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74773&edit=1 ID: 74773 User updated by: jan0michael at yahoo dot com Reported by: jan0michael at yahoo dot com Summary: Wrong SCRIPT_NAME with Tomcat and CGIServlet Status: Open Type: Bug Package: Servlet related Operating System: Linux Debian 8.8,Tomcat 9 M21 PHP Version: 5.6.30 Block user comment: N Private report: N New Comment: What would solve the problem: A command line parameter to php or a setting in php.ini, that prevents php from changing environment variables. Previous Comments: ------------------------------------------------------------------------ [2017-06-17 14:26:08] jan0michael at yahoo dot com Description: ------------ I try to run nextcloud using Tomcat. In the configuration for the CGIServlet I set /usr/bin/php5 as executable. I connect my web browser to 127.0.0.1:8086/nextcloud/index.php. This executes /usr/bin/php5 /var/www/default/nextcloud/index.php. The CGIServlet sets the environment variable SCRIPT_NAME correctly to /nextcloud/index.php, but the php interpreter changes the variable to /var/www/default/nextcloud/index.php, what makes nextcloud throw an exception. I found no way to prevent php from changing SCRIPT_NAME, and using the already set value instead. Test script: --------------- What I think how the CGIServlet should be configured in web.xml: <servlet> <servlet-name>php-cgi</servlet-name> <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class> <init-param> <param-name>executable</param-name> <param-value>/usr/bin/php5</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>php-cgi</servlet-name> <url-pattern>*.php</url-pattern> </servlet-mapping> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74773&edit=1

« previous php.bugs (#209565) next »