skip to Main Content

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!

3

Answers


  1. 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.

    Login or Signup to reply.
  2. 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

    Login or Signup to reply.
  3. 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!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search