简体   繁体   中英

php include problem

When i try to load a page that resides in /var/www/vhosts/mypage/httpdocs/index.php using a browser I get an include error that it cannot include file which is in /var/www/fw/trunk.

include path is set to include_path='.:/var/www/fw/trunk'.

But when I try to load it from console using 'php index.php' it loads fine, i guess it some kind of a permission problem but I can't seem to find what and where.

You need to make sure that the webserver or php process is able to read the folder an the files at least. Search for chown and chmod .

Your web server is probably accessing the file system as www-data. You should make sure /var/www/fw/trunk is readable by that user or group.

You can test this by switching to the www-data user and manually viewing the file.

As root, you can switch user without knowing the password.

su www-data

If you encounter a directory you can not traverse as www-data, your web app will also fail there. You can use chmod to open the directory.

I found a solution, it was this thing I had to put in a config file for that virutal host:

php_admin_value safe_mode off

php_admin_value open_basedir none

Does the page you're trying to include compile?

Otherwise, make sure that read and execute permission is given to everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM