|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74773 Wrong SCRIPT_NAME with Tomcat and CGIServlet
Submitted: 2017-06-17 14:26 UTC Modified: 2017-06-18 09:44 UTC
From: jan0michael at yahoo dot com Assigned:
Status: Not a bug Package: Servlet related
PHP Version: 5.6.30 OS: Linux Debian 8.8,Tomcat 9 M21
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jan0michael at yahoo dot com
New email:
PHP Version: OS:


 [2017-06-17 14:26 UTC] jan0michael at yahoo dot com
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

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:




Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-17 14:29 UTC] 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 20:06 UTC] jan0michael at yahoo dot com
-Status: Open +Status: Closed
 [2017-06-17 20:06 UTC] 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-18 09:44 UTC]
-Status: Closed +Status: Not a bug
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 12 09:05:46 2022 UTC