php include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear' cpanel 错误

php include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear' error in cpanel

我正在我的 wampServer(本地主机)上测试我的 php 应用程序,它一切正常! 但是,当我将同一个应用程序上传到我的网络服务器时,我得到了这个问题:

PHP 致命错误:require_once(): 需要打开失败 'util/DB_Connect.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/th27664/minierp.sistemaids.com.br/header.php 第 5

我不知道为什么,因为它与我用于本地主机应用程序的文件相同

这是我的部分代码:

<body class="animsition">
<?php 

        require_once 'header.php';
    require 'controller/controllerProduto.php';
        require 'controller/ControllerEmitente.php';
        $controle = new ControllerProduto();
        $ControleEmitente = new ControllerEmitente();

重要细节:我的 header.php 文件与此文件位于同一文件夹中。

非常感谢!

请尝试使用 root relative url,例如

require_once '/home/youraccount/public_htm/yourdirectory/header.php'

absolute url喜欢

require_once 'http://yoursite.com/yourdirectory/header.php'

不要使用 document relative url

可能问题出在 .htaccess 文件中。如果您使用 html 扩展文件并在 php 中写入,在 .htaccess 中您应该添加: AddType application / x-httpd-php5 .html

我修改了 cPanel 中 php-fpm 的系统默认配置(下面的 yaml)以将 php open_basedir 设置为安全措施。自从这样做以来,我也得到了你遇到的 include_path 错误。

要修复,请添加:

php_value_include_path: 
  name: php_value[include_path]
  value: "[% documentroot %]"

注意缩进。

收件人:

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

然后,为了更好的衡量,我强制 WHM 使用 WHM 步骤重新处理文件:

  1. 主页 »软件 »MultiPHP 管理器(系统 PHP-FPM 配置选项卡)
  2. 将最大请求数更改为 1(向上或向下),然后向下滚动并点击保存配置
  3. 首页»重启服务»PHP-Apache的FPM服务(重启服务)

希望对您有所帮助!