php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jan0michael at yahoo dot com
New email:
PHP Version: OS:

 

 [2017-06-17 14:26 UTC] 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> 



Patches

Pull Requests

History

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] requinix@php.net
-Status: Closed +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC