PHP 4.0 Bug #7503 Updated: scripts run from CGI output "#!/usr/local/bin/php -q" line
| From: | jason@php.net | Date: | Mon, 20 Nov 2000 22:46:22 +0000 |
| Subject: | PHP 4.0 Bug #7503 Updated: scripts run from CGI output "#!/usr/local/bin/php -q" line | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-38716@lists.php.net to get a copy of this message | ||
ID: 7503
Updated by: jason
Reported By: colin@easydns.com
Status: Open
Bug Type: Performance problem
Assigned To:
Comments:
colin>/path/to/php /path/to/test-file.php
colin>also outputs the hash-bang line (but that's expected, colin>since it's outside
colin>of <? ?>
colin>tags and would get treated as HTML).
Actually the way Unix treats shebangs is to tracnslate
#!/bin/program
to
/bin/program script
So php has code to prune '#'s' out of the statements.
But the code just double checks its not stdin thats being parsed.
Is the configure script you used to produce the standalone the same?
"--with-apxs=/usr/local/apache/bin/apxs"
caught my attention.
Did you compile the standalone with symbols?
If you did and feel like running it through a debugger
gdb /path/to/php
break 699
run /path/to/script/file.php
see if that if statement evaluates as true... it is supposed to(But by your description it sounds
like it isnt). You will notice the comment pruneing code lies in a true result of that condition.
If you get stuck why dont you email me a copy of your php binary.
About the kludgy solution, I know it was painful to put that in. Don't worry though it will be
gone soon : )
-Jason
Previous Comments:
---------------------------------------------------------------------------
[2000-11-20 17:38:15] jason@php.net
Is the configure script you used to produce the standalone the same?
"--with-apxs=/usr/local/apache/bin/apxs"
caught my attention.
Did you compile the standalone with symbols?
If you did and feel like running it through a debugger
gdb /path/to/php
break 699
run /path/to/script/file.php
see if that if statement evaluates as true... it is supposed to(But by your description it sounds
like it isnt). You will notice the comment pruneing code lies in a true result of that condition.
If you get stuck why dont you email me a copy of your php binary.
About the kludgy solution, I know it was painful to put that in. Don't worry though it will be
gone soon : )
-Jason
---------------------------------------------------------------------------
[2000-11-20 17:17:42] colin@easydns.com
My configure line is:
./configure --with-mysql=/usr/local/mysql
--with-apxs=/usr/local/apache/bin/apxs
--enable-track-vars
--disable-debug
--disable-magic-quotes
--enable-ftp
--with-gettext
--with-xml
--with-dom
--enable-wddx
--with-curl
--with-pgsql
--with-zlib
--enable-versioning
--with-openssl
--with-snmp
--with-sablot
--with-mcrypt
Running the standalone as:
/path/to/php /path/to/test-file.php
also outputs the hash-bang line (but that's expected, since it's outside of <? ?>
tags and would get treated as HTML).
Your grep suggestion works ... kludgy, but it works. I just think there must be something wrong in
PHP since I used to run scripts through cron like this all the time without incident.
- Colin
---------------------------------------------------------------------------
[2000-11-20 17:01:54] jason@php.net
The way you are using this should not have any problems.
I have not been able to reproduce this. What is your compile string?
Also, can you try running the standalone as follows? :
/path/to/php /path/to/test-file.php
By the way, a temporary work around for your cron job, until we solve your problem would be
grep -v '#!' /path/to/my/script.phx | /path/to/php
---------------------------------------------------------------------------
[2000-11-20 16:00:55] colin@easydns.com
I'm not running them through STDIN.
I'm running them right from the command line:
./script.phx
...or from cron:
15 1,13 * * * /path/to/my/script.phx
Or am I misunderstanding you?
(the script files start with "#!/path/to/php -q")
- Colin
---------------------------------------------------------------------------
[2000-11-20 15:35:00] jason@php.net
You must be running them through stdin ex "php < file".
If so, this is not a bug
If you are using shebang, you should just execute the script ./script. If you have to run php
manualy then you will need to pass files in as args, not as stdin
ex. php file1.php
---------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view the rest of the comments,
please view the bug report online.
Full Bug description available at: http://bugs.php.net/?id=7503