【发布时间】:2016-09-25 09:53:28
【问题描述】:
我们使用 PHP 5.6 开发了一个 WordPress/WooCommerce 网站,我们希望升级到 PHP7。该网站在 5.6 上完美运行,但在 PHP7 上运行会提高网站速度。
更改为 PHP7 导致以下 500 错误:
PHP 致命错误:require_once(): Failed opening required '' (include_path='.:/usr/local/php70/pear') 在 /home/servername/public_html/customer/customername/wp-content/themes/flux/framework/qode-framework.php 在第 4 行
我们在另一个主机的另一个 PHP7 服务器上使用该站点的副本进行了快速测试,PHP7 工作正常。所以应该是服务器设置,但我想不通。
如果有人能帮助我理解这个问题,那就太好了!
谢谢
【问题讨论】:
-
参见
qode-framework.php第 4 行,包含的文件路径错误。替换为函数require_once()中的正确文件路径。 -
@AHJeebon 感谢您的反馈。在第 4 行的
qode-framework.php中,它声明require_once("lib/qode.framework.php");文件就在那里。相对路径名可能有问题吗?在stackoverflow的某个地方,我读到了一个类似的错误,它与错误的根有关。我可以包含绝对路径名吗? -
使用相对路径:
require_once(dirname(__FILE__).'/**here write your relative path, if back directory then use (../)**'); -
感谢您的努力。我实施了您的建议,但错误仍然相似。所需打开失败从 ' ' 到 '%':
PHP Fatal error: require_once(): Failed opening required '%' (include_path='.:/usr/local/php70/pear') in /home/servername/public_html/customer/customername/wp-content/themes/flux/framework/qode-framework.php on line 4 -
我的主机有类似的问题,我的应用程序使用 php 5.6 工作文件,但是当我切换到 php 7、7.2、7.4 时,我会得到 'include_path='.:/usr/local/php70 /pear ' 每个版本的php都有错误,所以我认为是php版本的问题,我还在寻找解决方案。