468,290 Members | 2,077 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,290 developers. It's quick & easy.

exec(), system(), chdir() problem

Hi everyone,

I have a very strange problem when trying to run a simple php script:

ob_start();
$e=chdir("/usr/lib") or die("Could not change directory");
echo getcwd();
ob_end_flush();

when I run it through command line, it gives me /usr/lib/ but when I run it through the browser it always shows my current web directory where the script is located. I tried using exec(), system(), passthru() etc. All work through command line but through a browser I get no message (no errors as well as the code after these work normally). I am running Fedora Core 3.0 with Plesk.

Many thanks,

Hari
Oct 27 '06 #1
3 2984
ronverdonk
4,258 Expert 4TB
This only changes the directory for PHP, the output directory stays the same.

When using PHP safe mode and trying to change to a dir that is not accessible due to the safe mode restrictions, the function simply fails without generating any kind of error message.
Did you have a look at that PHP document?

Ronald :cool:
Oct 27 '06 #2
Hi,

I am fairly new to this so if you could let me know what am I doing wrong as when I moved this script to another server it seems to work.

Thanks
Oct 27 '06 #3
Hi,

just checked the php.ini settings but it seems safe mode is off, any reason. I also restarted Apache. hmmmm any reason why this is not working on this server?

Thanks again
Oct 27 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Jerry | last post: by
6 posts views Thread by Hal Vaughan | last post: by
4 posts views Thread by Benoit Dejean | last post: by
3 posts views Thread by dannycolligan | last post: by
7 posts views Thread by Mark Rae | last post: by
4 posts views Thread by CorfuVBProgrammer | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.