471,086 Members | 1,205 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,086 software developers and data experts.

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

Hi everyone,

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

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

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,

Oct 27 '06 #1
3 3087
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

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.

Oct 27 '06 #3

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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.