Bug #74773 [Csd->Nab]: Wrong SCRIPT_NAME with Tomcat and CGIServlet
| From: | requinix@php.net | Date: | Sun, 18 Jun 2017 09:44:02 +0000 |
| Subject: | Bug #74773 [Csd->Nab]: Wrong SCRIPT_NAME with Tomcat and CGIServlet | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209571@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
Updated by: requinix@php.net
Reported by: jan0michael at yahoo dot com
Summary: Wrong SCRIPT_NAME with Tomcat and CGIServlet
-Status: Closed
+Status: Not a bug
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
Previous Comments:
------------------------------------------------------------------------
[2017-06-17 20:06:15] jan0michael at yahoo dot com
SCRIPT_NAME is not changed with /usr/bin/php5-cgi.
I close this bug.
Sorry for having filed a bug report, I am not yet familiar with PHP.
------------------------------------------------------------------------
[2017-06-17 14:29:26] jan0michael at yahoo dot com
What would solve the problem:
A command line parameter to php or a setting in php.ini, that prevents php from changing environment
variables.
------------------------------------------------------------------------
[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