php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28126 calling PHP CLI from other CGI ignores command-line
Submitted: 2004-04-23 17:04 UTC Modified: 2004-04-23 17:47 UTC
From: rasch at raschnet dot com Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 4.3.4 OS: Linux 2.4.25 (Debian unstable)
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rasch at raschnet dot com
New email:
PHP Version: OS:

 

 [2004-04-23 17:04 UTC] rasch at raschnet dot com
Description:
------------
the php CGI binary detects the SERVER_SOFTWARE, SERVER_NAME, GATEWAY_INTERFACE, REQUEST_METHOD, and then ignores all command-line parameters.  The result is, that the below script combination prints out the entire perl script to the web server, since it reads it, and finds 0 php start/end tags.  I needed to do the below as we're working on a transition of some scripts from Perl to PHP.  As a workaround, i had to change the "system" line to "unset" all the environment variables listed above before launching the php script. 

Reproduce code:
---------------
-- perl script:
#!/usr/bin/perl

system("/path/to/script.php");


-- /path/to/script.php:
#!/usr/bin/php4 -q

print ("hello");


Expected result:
----------------
Expected the result to be "hi"

Actual result:
--------------
web server prints:
#!/usr/bin/perl

system("/path/to/script.php");



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-23 17:47 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The CGI binary used the SERVER_SOFTWARE environment 
variable to determine if it is running on the command line 
or via a webserver. If this environment variable is set, 
then CGI binary thinks it is running from the server and 
does not parse command line arguments. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 15:01:30 2024 UTC