|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-03-19 18:42 UTC] gk at proliberty dot com
I'm using php4-STABLE-200303191630 Problem is with sapi/cli/php The problem has TWO, possibly related parts: 1. when cli/php is invoked with script argument, FATAL error messages go to /dev/stdout instead of /dev/stderr, making it difficult to handle errors properly 2. when cli/php is invoked with -r '...' option, error messages are lost ENTIRELY, although output preceding the fatal command is not. //test.php <?php echo "begin\n"; f(); // undefined function; fatal error echo "end\n"; ?> #OUTPUT OF SCRIPT: [greg@p3 junk]$ php "test.php" begin Fatal error: Call to undefined function: f() in /usr/local/apache/htdocs/common/test/junk/test.php on line 3 [greg@p3 junk]$ php "test.php" 1>/dev/null [greg@p3 junk]$ php -r 'require "test.php";' begin [greg@p3 junk]$ PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 16:00:01 2025 UTC |
I can not reproduce this with the latest stable snapshot: # php -n -r 'require("test.php");' begin /home/jani/test.php(3) : Fatal error - Call to undefined function: f() Try this. ('-n' is for not using any php.ini)I have tried your suggestion same test file and with: php4-STABLE-200303210630 (March 21) I get the same results: [greg@p3 junk]$ php -n -r 'require("junk.php");' begin [greg@p3 junk]$ php -r 'require("junk.php");' begin [greg@p3 junk]$ php junk.php begin Fatal error: Call to undefined function: f() in /usr/local/apache/htdocs/common/test/junk/junk.php on line 3 [greg@p3 junk]$ Perhaps the difference is in our configure options. Mine are: ./configure --with-dom --with-zlib-dir=/usr/include --with-mysql=/usr/local/mysql --with-apxs=/usr/local/apache/bin/apxs --with-xml --enable-track-vars Please let me know if we need to split this but into two: have you tested the issue of error messages not going to /dev/stderr or only the -r issue?Try this with latest stable snapshot: # rm config.cache # ./configure --disable-all --disable-cgi && make clean && make # sapi/cli/php -n -r "require('test.php');" I think you're just doing something wrong / have something setup very differently in your server..I built it again, per your instructions and get the same result: [root@p3 php4-STABLE-200303210630]# sapi/cli/php -n -r "require('/htdocs/common/test/junk/junk.php');" begin [root@p3 php4-STABLE-200303210630]# Do I need a more recent snapshot than that? I'm using the same test file: /htdocs/common/test/junk/junk.php: <?php echo "begin\n"; f(); // undefined function; fatal error echo "end\n"; ?>