Reputation: 11
I want to change directory using chdir
in php, because i need to execute command in Linux.
My current directory is /var/www/httpdocs/website/admin
,I want to go to httpdocs's sub_directory docs
.I use absolute path like:
chdir("/var/www/httpdocs/docs");
but it does't work.
I only can get website using : chdir("../");
or get admin's sub_directory images
using : chdir("/var/www/httpdocs/website/admin/images");
but I can't get httpdocs
.
what's wrong?
Any tips would be appreciated.
Upvotes: 1
Views: 4167
Reputation: 1971
Are you sure you have enough user rights to go outside of the website
directory ?
If you enable error display, maybe you will understand what's going on. Please try your script again by adding this on top of your php file:
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
And let me know which error messages you see.
Upvotes: 2