Re: [PHP] Problem with the passthru function
On Wed, June 14, 2006 4:51 am, Venkatesh Babu wrote: > I have a small php file (test.php) whose code is shown > below: > > $retval=1; > $command='/bin/ls'; > passthru($command, $retval); > print("Exit status: " . $retval); > ?> > > This test.php works fine when I execute from command > prompt as "php test.php", but when I access it through > web browser, it seems not to be working fine, I get an > exit status of 127 (which means command not found). I > checked for permissions of ls, gave full path, but > still it is failing. > > Can anybody help me in indentifying what is the > potential problem? That is pretty odd, as you seem to have covered the Usual Mistakes... I guess my next move would be to try: if (file_exists('/bin/ls')){ echo "Okay, /bin/ls does exist.\n"; } else{ echo "Hmmm... PHP says /bin/ls does not exist.\n"; } if (is_executable('/bin/ls')){ echo "Okay, /bin/ls is executable.\n"; } else{ echo "hmmm... PHP says /bin/ls is not executable.\n"; } and so on... Try every which way from PHP to check out /bin/ls to see if it is there. I suppose it's also possible that the default Environment for PHP is attempting to ls a directory for which you do not have access... Try using '/bin/ls /full/path/to/your/web/tree' instead. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with the passthru function
Hi, Thanks for your response safe_mode is Off but still I'm getting this problem. Thank you, Venkatesh --- Rabin Vincent <[EMAIL PROTECTED]> wrote: > On 6/14/06, Venkatesh Babu <[EMAIL PROTECTED]> > wrote: > > I have a small php file (test.php) whose code is > shown > > below: > > > > > $retval=1; > > $command='/bin/ls'; > > passthru($command, $retval); > > print("Exit status: " . $retval); > > ?> > > > > This test.php works fine when I execute from > command > > prompt as "php test.php", but when I access it > through > > web browser, it seems not to be working fine, I > get an > > exit status of 127 (which means command not > found). I > > checked for permissions of ls, gave full path, but > > still it is failing. > > > > Can anybody help me in indentifying what is the > > potential problem? > > Check if safe_mode is on in your php.ini. Turn it > off > if it is enabled. > > Rabin > __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with the passthru function
On 6/14/06, Venkatesh Babu <[EMAIL PROTECTED]> wrote: I have a small php file (test.php) whose code is shown below: This test.php works fine when I execute from command prompt as "php test.php", but when I access it through web browser, it seems not to be working fine, I get an exit status of 127 (which means command not found). I checked for permissions of ls, gave full path, but still it is failing. Can anybody help me in indentifying what is the potential problem? Check if safe_mode is on in your php.ini. Turn it off if it is enabled. Rabin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem with the passthru function
Hello All, I have a small php file (test.php) whose code is shown below: This test.php works fine when I execute from command prompt as "php test.php", but when I access it through web browser, it seems not to be working fine, I get an exit status of 127 (which means command not found). I checked for permissions of ls, gave full path, but still it is failing. Can anybody help me in indentifying what is the potential problem? Thank you, Venkatesh ps: Sorry if this is the wrong mailing list. I have subscribed to this list, so posting here. __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php