简体   繁体   中英

index.php require results in 500 internal server error

I've been looking for a long time, but I can't find the problem at all and this is supposed to be simple...

I have no problem running my index.php file (eg. echo "test";), but the moment I try to require another php file, I get a "500 internal server error" message.

require(dirname( __FILE__ ) . '/test.php');

These files are under /var/www/html I've got no clue what is the problem.

I'm on a VPS running CentOS 6.4.

Do you have some guidelines where I can locate the problem?
Perhaps some configuration issue?
I'm really out of options.

Thanks.

are you sure that your file exitsts and is readable ?

verify that by var_dump(is_readable(dirname( __FILE__ ) . '/test.php'));

The problem was that open_basedir was set to the wrong path.
After adapting it to:

php_admin_value open_basedir

/var/www/html/:/tmp:/var/tmp:/usr/local/lib/php/:/usr/local/php54/lib/php/

Everything is fine! I think that I have made a wrong configuration here in the past when I was careless, while configuring other virtual hosts in the same file.

I'm not sure why I didn't immediately get feedback in the error logs, but the problem is solved anyway.

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