sh: /ls: No such file or directory

roly

Verified User
Joined
Nov 9, 2006
Messages
197
hi

i've got a script that for some reason is giving the error:

sh: /ls: No such file or directory

and yet ls works if i run from the command line in ssh but running the very same line from the script gives this error.

the line that's causing the error is:

$list=exec("ls /home/*/domains/*/public_html | grep public_html | tr -d '\n'");

and yet if i run:

ls /home/*/domains/*/public_html | grep public_html | tr -d '\n'

straight from the command line it works. i've tried changing ls to /bin/ls and it still doesn't work. has anyone got any ideas what the problem is? this was working before and the same script works on my other server so i 'm not sure what the problem is. any advice appreciated.

thanks in advance

roland
 
Are you getting the exact same error when using /bin/ls? if so, have you tried in ssh if /bin/ls exists?
 
maybe exec is disabled in php.ini ?

exec isn't disabled as far as i can see, but when i turn off safe_mode it seems to run. so its something like what you suggest.

i only need to run this script manually occasionaly so i can just turn off safe mode whilst running it.

so problem sorted, thanks everyone for your help.

:)
 
Back
Top