0

I'm kinda novice on setting up a PHP environment (Apache), but nothing to do about it. I have a VPS, which has Ubuntu 12.04 LTS.

My issue is that I receive following error:

[Wed Nov 13 16:43:31 2013] [error] [client 127.0.0.1] PHP Fatal error: Unknown: Failed opening required '/root/blog/index.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

index.php contains following code:

<?php  
print phpinfo();  
?>

It is WORKING IF it is located under "/var/www/" directory. But I wanted to change the location of the script to "/root/blog".

I have re-configured the "000-default" configuration file under "sites-enabled" folder in apache2 folder. So it shouldn't be a problem.

I've tried assigning different permissions (chmod 777) to "/root/blog" folder (both: recursively and traditionally), but no avail.

I've checked the user and user group for the "/var/www" folder and files, and they are: root/root - root user and root group. So, that should not be an issue.

What should I do about it ? Can someone help me ?

P.S AFAIK, apache version: 2.2, PHP: 5.3.10 (installed today, using apt-get install php5 apache2)

4

1 回答 1

2

我想问题来自 Apache 用户没有权限读取/执行目录下的/root文件,因为毕竟那是 root 用户的主目录。

我真的建议您不要为您的网站提供服务,/root但如果您真的想尝试执行此命令:

chown -R nobody /root/blog

(我假设nobody是您的 Apache 用户)

出于好奇,为什么要从 运行网站/root/var/www是网站文件的标准位置,如果文件在此目录下时它可以工作,为什么不坚持呢?

于 2013-11-13T15:11:02.597 回答