ID: 46477
User updated by: rachmel at avaya dot com
Reported By: rachmel at avaya dot com
-Status: Feedback
+Status: Open
Bug Type: Apache related
Operating System: Linux 2.6.14.7
PHP Version: 5.2CVS-2008-11-05
New Comment:
Here's the configure line used:
Configure Command => './configure'
'--host=i686-linux'
'--build=i686-linux'
'--prefix=/usr/local'
'--disable-all'
'--enable-static'
'--disable-shared'
'--enable-memory-limit'
'--disable-safe-mode'
'--disable-rpath'
'--disable-ipv6'
'--disable-wddx'
'--disable-bcmath'
'--enable-debug'
'--disable-calendar'
'--enable-ftp'
'--without-aolserver'
'--without-apache'
'--without-continuity'
'--without-pi3web'
'--enable-releasemode'
'--enable-xml'
'--cache-file=config.cache'
'--enable-libxml'
'--with-libxml-dir=/usr/local'
'--disable-simplexml'
'--enable-dom'
'--enable-soap'
'--with-db'
'--enable-sockets'
'--enable-track-vars'
'--enable-trans-sid'
'--enable-magic-quotes'
'--without-pear'
'--with-zlib'
'--with-exec-dir=/usr/local/appweb'
'--sysconfdir=/usr/local/appweb'
'--with-gnu-ld'
'--with-openssl=/usr'
'--enable-mbstring'
'--disable-mbregex'
'--enable-session'
'--enable-pcntl'
'--enable-pdo'
'--with-pdo-sqlite=/usr/local'
'--with-pcre-regex'
'--enable-spl'
'--enable-tokenizer'
'--with-snmp=/usr/local'
'--enable-ctype'
'--enable-apc'
'--with-ctype'
'--without-tsrm-pthreads'
'--disable-threadsafe'
'--disable-maintainer-zts'
'--enable-embed=shared'
'--enable-cgi'
'--enable-cli'
'--enable-inline-optimization'
'--with-curl=/usr/local'
'--with-curlwrappers'
'--enable-cipher'
Previous Comments:
------------------------------------------------------------------------
[2008-11-06 01:20:39] jani@php.net
And you should really check what $output contains using this:
var_dump($output);
------------------------------------------------------------------------
[2008-11-06 01:18:57] jani@php.net
What exactly is the configure line you used? Can you reproduce this
problem using real Apache?
------------------------------------------------------------------------
[2008-11-05 08:09:21] rachmel at avaya dot com
Tried with the latest CVS snapshot you attached, and the result is the
same.
I am not working in CGI mode. As my web-server is apache like, it
supports running php scripts natively. It links to the libphp5.so
created after the installation of php and makes use of it directly.
------------------------------------------------------------------------
[2008-11-04 22:31:43] jani@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
And what SAPI are you using? I guess CGI or FastCGI since there is no
"native" SAPI for this odd webserver.
------------------------------------------------------------------------
[2008-11-04 09:49:40] rachmel at avaya dot com
Description:
------------
PHP's exec function returns the wrong return value.
When running script from CLI, works perfectly. When running the same
script from the web-server context - 90% of the times it returns the
wrong value - (-1).
I am using the appWeb embedded server, which is a slim apache-like
webserver.
I validated there are no permission running issues, and I couldn't see
any log messages sent by PHP that might indicate what the problem is.
Reproduce code:
---------------
<?php
print "<pre>";
for ($i = 0; $i < 10; ++$i) {
exec("/bin/true", $output, $status);
print "exec('/bin/true') returns with <b>$status</b> (expected
0)\n";
}
for ($i = 0; $i < 10; ++$i) {
exec("/bin/false", $output, $status);
print "exec('/bin/false') returns with <b>$status</b> (expected
1)\n";
}
print "</pre>";
?>
Expected result:
----------------
All executions of "true" should print "0" to the screen
All executions of "false" should print "1" to the screen.
Actual result:
--------------
Most of the times, all executions result in an error code of "-1" being
printed to the screen.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46477&edit=1