Php 打开所需错误失败。要求一次
我在错误日志中从我的网站收到以下错误:Php 打开所需错误失败。要求一次,php,apache,Php,Apache,我在错误日志中从我的网站收到以下错误: [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 /va
[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");
?>
php文件位于正确的位置,因此我对发生这种情况的原因感到有点困惑。我尝试将核心文件夹放在/usr/share/php中,但这并没有解决问题。有什么建议吗
编辑:
我刚才也看到了这个错误:
[Wed Jul 02 07:36:58 2014][error][client 94.10.110.115]PHP警告:require_once(/usr/share/PHP/core/public_html/loader.PHP):无法打开流:第3行的/var/zpanel/hostdata/zadmin/public_html/cmu 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
用于CentOS Linux的Apache Include文件
#Bobby Allen撰写,2011年5月15日
#设置Zpanel别名(用于开发,sable最终将使用VHOST)
别名/zpanel/etc/zpanel/panel
#设置Zpanel应用程序目录的目录设置和PHP安全标志。
选项如下符号链接
允许超越所有
DirectoryIndex.php
AddType应用程序/x-httpd-php.php
php_标志魔术_引号_gpc关闭
php_标志跟踪_变量打开
php_标志寄存器_全局关闭
php_admin_value upload_tmp_dir/etc/zpanel/temp
#不允许web访问不需要它/我们不希望人们查看的目录!
命令拒绝,允许
全盘否定
#设置服务器令牌(安全性??)
服务器令牌主要
#现在,我们包含了通用VHOST配置文件,该文件保存所有ZPanel用户托管的VHOST数据
Include/etc/zpanel/configs/apache/httpd-vhosts.conf
这似乎是由于“操作不允许”错误导致的权限问题。查看您的服务器是否在其配置中授予php对给定文件夹的访问权。另外,为了进行合理性检查,在将文件名传递给require_一次时回显该文件名
如果您发布了apache站点配置,这将非常有用。如果您阅读了错误消息,那么您将看到:
Operation not permitted
您的Web服务器进程没有访问权限
/usr/share/php/core/public_html/
在许多情况下,Web服务器都绑定到其根目录
/var/zpanel/hostdata/
您为什么建议使用此代码?请在此添加一些详细信息和进一步的回答。(您的答案被标记为低质量)此外,这是错误的,无法工作。我如何授予共享文件夹的权限或更改hostdata文件夹中的包含路径?这实际上取决于您的服务器配置。在php中,如果设置了open_basedir,则有一个限制。Suhosin还可以限制访问。我认为这与Web服务器工作进程更相关。该帐户似乎受到限制,无法访问/var。谢谢。我会看看zpanel论坛上是否有人曾经遇到过这种情况。我现在添加了apache配置。非常感谢。
/var/zpanel/hostdata/