ID: 36060 Updated by: [EMAIL PROTECTED] Reported By: support-forums4 at farmdev dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: FreeBSD PHP Version: 5.1.2 New Comment:
No, the CGI should not be used on the command line - there are other reasons why you shouldn't do this. Use the CLI (stands for Command Line Interface) for command line work. Previous Comments: ------------------------------------------------------------------------ [2006-01-17 23:07:24] support-forums4 at farmdev dot com I understand it's not ideal that our server uses the cgi version from the command line but it is confusing that php includes `--' in the arguments when it has already gone so far as to pass through the extra arguments. In other words, if cgi should *never* be used on the command line, why doesn't: $ php -f test_end_arg.php -- -f -p simply produce: Array ( [0] => test_end_arg.php ) ? I think we can agree that the cgi version should be able to work from the command line. On the other hand, I'm sure there are a million more important bugs to fix ... but this did trip me up for a while and seems trivial to fix. thanks, Kumar ------------------------------------------------------------------------ [2006-01-17 22:58:08] [EMAIL PROTECTED] 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 Command line parsing is different between those two SAPIs. You should only use the CLI for command line work... as that\'s what it was meant for. ------------------------------------------------------------------------ [2006-01-17 22:56:33] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5.1-latest.tar.gz For Windows: http://snaps.php.net/win32/php5.1-win32-latest.zip ------------------------------------------------------------------------ [2006-01-17 22:53:30] support-forums4 at farmdev dot com Description: ------------ see test script, run it like ... $ php -f test_end_arg.php -- -h -f PHP should execute the script as the equivalent of `test_end_arg.php -h -f`. This works in the cli version of php but not the cgi version (from command line). Sorry I couldn't test on more versions. Cli version I tested with (PASSED) was : ==================== PHP Version => 5.0.4 System => Linux dev 2.4.18-1-686 #1 Wed Apr 14 18:20:10 UTC 2004 i686 Build Date => May 12 2005 14:12:56 Configure Command => './configure' '--prefix=/vol2/php5' '--with-apxs=/vol2/php5/bin/apxs' '-with-config-file-scan-dir=/vol2/php5/lib/php' '--enable-shared' '--with-zlib=shared' '--with-curl=shared,/vol2/php5' '--with-mcrypt=shared,/vol2/php5' '--with-mhash=shared,/vol2/php5' '--with-openssl=shared' '--with-gettext=shared' '--with-gd=shared' '--enable-wddx=shared' '--with-jpg-dir=/usr' '--with-png-dir=/usr' '--enable-dba=shared' '--with-mysql=shared,/usr/local/mysql' '--with-pgsql=shared,/usr/local/pgsql' '--enable-soap=shared' '--enable-sysvshm=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--with-libxml-dir=/vol2/php5' Server API => Command Line Interface ==================================== CGI version I tested with (FAILED) was : ==================================== PHP Version 5.0.5 System FreeBSD dev2.leapfrogonline.com 4.11-RELEASE FreeBSD 4.11-RELEASE #0: Fri Ja i386 Build Date Sep 22 2005 16:22:00 Configure Command './configure' '--enable-versioning' '--enable-memory-limit' '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enable-spl' '--with-regex=php' '--disable-cli' '--enable-force-cgi-redirect' '--enable-discard-path' '--enable-fastcgi' '--prefix=/usr/local' 'i386-portbld-freebsd4.11' Server API CGI/FastCGI ==================================== Reproduce code: --------------- test_end_arg.php: <?php print_r($_SERVER['argv']); assert( !in_array('--',$_SERVER['argv'])); ?> Expected result: ---------------- // see description about how to run the script Array ( [0] => test_end_arg.php [1] => -h [2] => -f ) Actual result: -------------- PHP Warning: assert() [<a href='function.assert'>function.assert</a>]: Assertion failed in /home/kumar/tmp/test_end_arg.php on line 3 Array ( [0] => test_end_arg.php [1] => -- [2] => -h [3] => -f ) <br /> <b>Warning</b>: assert() [<a href='function.assert'>function.assert</a>]: Assertion failed in <b>/home/kumar/tmp/test_end_arg.php</b> on line <b>3</b><br /> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36060&edit=1