|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-11 04:57 UTC] sebastian@php.net
Description:
------------
sb@vmware ~ % cat test.php
<?php
shell_exec("php -v");
sb@vmware ~ % which php
/usr/local/php-5.2/bin/php
sb@vmware ~ % php -v
PHP 5.2.3-dev (cli) (built: May 11 2007 05:52:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
with Xdebug v2.0.0RC4-dev, Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, by Derick Rethans
sb@vmware ~ % php test.php
sh: php: not found
sb@vmware ~ % vim test.php
sb@vmware ~ % cat test.php
<?php
shell_exec("/usr/local/php-5.2/bin/php -v");
sb@vmware ~ % php test.php
Reproduce code:
---------------
<?php
shell_exec("php -v");
Expected result:
----------------
No output.
Actual result:
--------------
sh: php: not found
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 19:00:02 2025 UTC |
sb@wopr-mobile ~ % cat test.php <?php print_r($_ENV); sb@wopr-mobile ~ % valgrind php test.php ==32011== Memcheck, a memory error detector. ==32011== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. ==32011== Using LibVEX rev 1658, a library for dynamic binary translation. ==32011== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==32011== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework. ==32011== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==32011== For more details, rerun with: -v ==32011== Array ( [CVS_RSH] => ssh [USER] => sb [CXXFLAGS] => -march=prescott -O2 -pipe [GNOME_KEYRING_SOCKET] => /tmp/keyring-aV2Gx9/socket [SSH_AGENT_PID] => 5344 [LD_LIBRARY_PATH] => /usr/lib/debug:/usr/X11R6/lib/debug [SHLVL] => 1 [OLDPWD] => /usr/local/src/php [HOME] => /home/sb [DESKTOP_SESSION] => default [GTK_RC_FILES] => /etc/gtk/gtkrc:/home/sb/.gtkrc-1.2-gnome2 [DBUS_SESSION_BUS_ADDRESS] => unix:abstract=/tmp/dbus-tyDNTTBGq8,guid=0589bce6a83acda7de032d0046448ed7 [GDM_XSERVER_LOCATION] => local [COLORTERM] => gnome-terminal [LOGNAME] => sb [_] => /usr/bin/valgrind [WINDOWID] => 29360224 [TERM] => xterm [GNOME_DESKTOP_SESSION_ID] => Default [SESSION_MANAGER] => local/wopr-mobile:/tmp/.ICE-unix/5345 [PATH] => /usr/local/src/phpunit/3.1 [GLIBCPP_FORCE_NEW] => 1 [CFLAGS] => -march=prescott -O2 -pipe [DISPLAY] => :0.0 [LANG] => en_US.UTF-8 [XAUTHORITY] => /home/sb/.Xauthority [SSH_AUTH_SOCK] => /tmp/ssh-GSPQwR5343/agent.5343 [SHELL] => /bin/zsh [GDMSESSION] => default [PWD] => /home/sb [GLIBCXX_FORCE_NEW] => 1 [LD_PRELOAD] => /usr/lib/valgrind/x86-linux/vgpreload_core.so:/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so ) ==32011== ==32011== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 49 from 1) ==32011== malloc/free: in use at exit: 0 bytes in 0 blocks. ==32011== malloc/free: 12,467 allocs, 12,467 frees, 1,654,668 bytes allocated. ==32011== For counts of detected errors, rerun with: -v ==32011== All heap blocks were freed -- no leaks are possible. sb@wopr-mobile ~ % valgrind /usr/local/php-5.2/bin/php test.php ==32029== Memcheck, a memory error detector. ==32029== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. ==32029== Using LibVEX rev 1658, a library for dynamic binary translation. ==32029== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. ==32029== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework. ==32029== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. ==32029== For more details, rerun with: -v ==32029== Array ( [CVS_RSH] => ssh [USER] => sb [CXXFLAGS] => -march=prescott -O2 -pipe [GNOME_KEYRING_SOCKET] => /tmp/keyring-aV2Gx9/socket [SSH_AGENT_PID] => 5344 [LD_LIBRARY_PATH] => /usr/lib/debug:/usr/X11R6/lib/debug [SHLVL] => 1 [OLDPWD] => /usr/local/src/php [HOME] => /home/sb [DESKTOP_SESSION] => default [GTK_RC_FILES] => /etc/gtk/gtkrc:/home/sb/.gtkrc-1.2-gnome2 [DBUS_SESSION_BUS_ADDRESS] => unix:abstract=/tmp/dbus-tyDNTTBGq8,guid=0589bce6a83acda7de032d0046448ed7 [GDM_XSERVER_LOCATION] => local [COLORTERM] => gnome-terminal [LOGNAME] => sb [_] => /usr/bin/valgrind [WINDOWID] => 29360224 [TERM] => xterm [GNOME_DESKTOP_SESSION_ID] => Default [SESSION_MANAGER] => local/wopr-mobile:/tmp/.ICE-unix/5345 [PATH] => /usr/local/src/phpunit/3.1:/usr/local/bin:/usr/local/php-5.2/bin:/usr/local/mysql-5.1/bin:/usr/lib/libming/bin:/usr/local/httpd/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games [GLIBCPP_FORCE_NEW] => 1 [CFLAGS] => -march=prescott -O2 -pipe [DISPLAY] => :0.0 [LANG] => en_US.UTF-8 [XAUTHORITY] => /home/sb/.Xauthority [SSH_AUTH_SOCK] => /tmp/ssh-GSPQwR5343/agent.5343 [SHELL] => /bin/zsh [GDMSESSION] => default [PWD] => /home/sb [GLIBCXX_FORCE_NEW] => 1 [LD_PRELOAD] => /usr/lib/valgrind/x86-linux/vgpreload_core.so:/usr/lib/valgrind/x86-linux/vgpreload_memcheck.so ) ==32029== ==32029== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 49 from 1) ==32029== malloc/free: in use at exit: 0 bytes in 0 blocks. ==32029== malloc/free: 12,465 allocs, 12,465 frees, 1,654,666 bytes allocated. ==32029== For counts of detected errors, rerun with: -v ==32029== All heap blocks were freed -- no leaks are possible.I think that the commit below is responsible for this: bjori Sun May 6 14:01:27 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/main php_ini.c /php-src NEWS Log: MFH: Fixed PHP CLI to use the php.ini from the binary location