Bluehost.com Web Hosting $6.95

passthru gives error in httpd/error_log

This is a discussion on passthru gives error in httpd/error_log within the PHP General forums, part of the PHP Programming Forums category; I'm trying to run a super simple command through passthru. Here's my test.php file: <html>&...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 11-21-2003
Jesper Hansen
 
Posts: n/a
Default passthru gives error in httpd/error_log

I'm trying to run a super simple command through passthru.

Here's my test.php file:

<html><body>
<? passthru('ls -l'); ?>
</body></html>


It works if run directly with "php test.php".
When this is run from the browser, there is no output, and the
following error is logged in /var/log/httpd/error_log :
sh: /ls: No such file or directory

What does this mean ? Any command I try instead of "ls -l",
gives a similar error.

The funky thing is that it HAS worked, but now it doesn't, and
I have no idea what happened.

Any clues and hints are much appreciated.

/Jesper
Reply With Quote
  #2 (permalink)  
Old 11-21-2003
Tom Rogers
 
Posts: n/a
Default Re: [PHP] passthru gives error in httpd/error_log

Hi,

Friday, November 21, 2003, 10:53:08 AM, you wrote:
JH> I'm trying to run a super simple command through passthru.

JH> Here's my test.php file:

JH> <html><body>
JH> <? passthru('ls -l'); ?>
JH> </body></html>


JH> It works if run directly with "php test.php".
JH> When this is run from the browser, there is no output, and the
JH> following error is logged in /var/log/httpd/error_log :
JH> sh: /ls: No such file or directory

JH> What does this mean ? Any command I try instead of "ls -l",
JH> gives a similar error.

JH> The funky thing is that it HAS worked, but now it doesn't, and
JH> I have no idea what happened.

JH> Any clues and hints are much appreciated.

JH> /Jesper

You probably have to put the full path to ls

<? passthru('/bin/ls -l'); ?>

--
regards,
Tom
Reply With Quote
  #3 (permalink)  
Old 11-21-2003
Jesper Hansen
 
Posts: n/a
Default Re: [PHP] passthru gives error in httpd/error_log

"Tom Rogers" <trogers@kwikin.com> wrote in message
news:197660146203.20031121110541@kwikin.com...
>
> You probably have to put the full path to ls
>
> <? passthru('/bin/ls -l'); ?>
> --
> regards,
> Tom


No, I've tried that along with all other obvious path stuff.

/Jesper
Reply With Quote
  #4 (permalink)  
Old 11-22-2003
Tom Rogers
 
Posts: n/a
Default Re[2]: [PHP] passthru gives error in httpd/error_log

Hi,

Saturday, November 22, 2003, 1:23:36 AM, you wrote:
JH> "Tom Rogers" <trogers@kwikin.com> wrote in message
JH> news:197660146203.20031121110541@kwikin.com...
JH> No, I've tried that along with all other obvious path stuff.

JH> /Jesper

Then there must be some kind of restriction on the server, Is it running in
chrooot enviroment. Try copying ls to a directory in the server root and try
again.
--
regards,
Tom
Reply With Quote
  #5 (permalink)  
Old 11-22-2003
Jesper Hansen
 
Posts: n/a
Default Re: Re[2]: [PHP] passthru gives error in httpd/error_log

> Then there must be some kind of restriction on the server, Is it running
in
> chrooot enviroment. Try copying ls to a directory in the server root and

try
> again.
> --
> regards,
> Tom


I've tried that too, with ls and other programs in the local directory where
the
script was located. And with permissions set to 777. Even on the dir. No go.
Still the same error log message : "sh: /ls: No such file or directory".
Specifying a specific path will give, for instance :
"sh: /bin/ls: No such file or directory".

This seems impossible, as the file is clearly there, but I can't find any
more
info on this message.

/Jesper
Reply With Quote
  #6 (permalink)  
Old 11-23-2003
Jason Wong
 
Posts: n/a
Default Re: [PHP] passthru gives error in httpd/error_log

On Friday 21 November 2003 08:53, Jesper Hansen wrote:

> I'm trying to run a super simple command through passthru.
>
> Here's my test.php file:
>
> <html><body>
> <? passthru('ls -l'); ?>
> </body></html>
>
>
> It works if run directly with "php test.php".
> When this is run from the browser, there is no output, and the
> following error is logged in /var/log/httpd/error_log :
> sh: /ls: No such file or directory


What does the php error log say?

> What does this mean ? Any command I try instead of "ls -l",
> gives a similar error.
>
> The funky thing is that it HAS worked, but now it doesn't, and
> I have no idea what happened.


Find out what funky thing it was that you did to make it stop working.

Are you using safe mode and is "safe_mode_exec_dir" set appropriately?

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz

/*
What is research but a blind date with knowledge?
-- Will Harvey
*/
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:53 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0