我在错误日志中从我的网站收到以下错误:
[Wed Jul 02 07:13:58 2014] [error] [client **.**.**.**]
PHP Fatal error: require_once(): Failed opening required '/var/zpanel/hostdata/
zadmin/core/public_html/loader.php' (include_path='.:/usr/share/pear:/usr/share/php')
in /var/zpanel/hostdata/zadmin/public_html/cmcatering_co_uk/index.php on line 3
在index.php中我有以下内容:
<?php
$code_base = "/var/zpanel/hostdata/zadmin/core";
require_once($code_base . "/public_html/loader.php");
?>
loader.php文件位于正确的位置,所以我对为什么会发生这种情况感到有些困惑。我尝试将核心文件夹放在/ usr / share / php中,但这并没有解决问题。有什么建议?
编辑:
我刚看到这个错误:
[Wed Jul 02 07:36:58 2014] [错误] [客户端94.10.110.115] PHP警告:require_once(/usr/share/php/core/public_html/loader.php):无法打开流:操作在第3行的/var/zpanel/hostdata/zadmin/public_html/cmcatering_co_uk/index.php中不允许
的httpd.conf:
# ZPanel Apache Include file for CentOS Linux
# Written by Bobby Allen, 15/05/2011
# Set the Zpanel Alias (used for development, sable will eventually use a VHOST)
Alias /zpanel /etc/zpanel/panel
# Setup the directory settings and PHP security flags for the Zpanel application directory.
<Directory /etc/zpanel/panel>
Options FollowSymLinks
AllowOverride All
DirectoryIndex index.php
<IfModule mod_php5.c>
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_value upload_tmp_dir /etc/zpanel/temp
</IfModule>
</Directory>
# Disallow web access to directories that don't need it/that we don't want people looking in!
<Directory /etc/zpanel/panel/cnf>
Order Deny,Allow
Deny from All
</Directory>
# Set server tokens (security??)
ServerTokens Maj
# Now we include the generic VHOST configuration file that holds all the ZPanel user hosted vhost data
Include /etc/zpanel/configs/apache/httpd-vhosts.conf
答案 0 :(得分:2)
如果您阅读了错误消息,那么您会看到:
Operation not permitted
您的网络服务器进程无权访问
/usr/share/php/core/public_html/
在许多情况下,Web服务器绑定到它们的根目录。
/var/zpanel/hostdata/
答案 1 :(得分:1)
由于操作不允许错误,这看起来好像是权限问题。查看您的服务器是否在其配置中授予对给定文件夹的php访问权限。也只是为了进行健全性检查,在传递给require_once时回显文件名。
如果您发布了apache站点配置,那将会很有帮助。
答案 2 :(得分:-1)
<?php
$code_base = "/var/zpanel/hostdata/zadmin/core";
require_once("<?php echo $code_base; ?>/public_html/loader.php");
?>