简体   繁体   中英

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

I was testing my php application on My wampServer (localhost) and its ALL works! But, when i uploaded this same application to my webserver i got this inssue:

PHP Fatal error: require_once(): Failed opening required 'util/DB_Connect.php' (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/th27664/minierp.sistemaids.com.br/header.php on line 5

I have no idea why, because its the same files that i used to my localhost application

Here is part of my code:

<body class="animsition">
<?php 

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

Important Detail: My header.php file is on the same folder of this file.

Thank you, very much!

Please try to use either root relative url like,

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

or absolute url like

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

Don't use document relative url .

maybe the problem is in the .htaccess file. If you use html extension files and write inside on php, in .htaccess you should add: AddType application / x-httpd-php5 .html

I modified the system default config (yaml below) for php-fpm in cPanel to set the php open_basedir as a security measure. Since doing that, I also got the include_path error you had.

To fix, add this:

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

Mind the indentation.

To:

/var/cpanel/ApachePHPFPM/system_pool_defaults.yaml

Then, for good measure, I force WHM to rehandle the file by using the WHM steps:

  1. Home »Software »MultiPHP Manager (System PHP-FPM Configuration Tab)
  2. Change Max Requests by 1 (up or down) then scroll down and hit Save Configuration
  3. Home »Restart Services »PHP-FPM service for Apache (restart the service)

Hope that helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM