简体   繁体   中英

PHP server log errors

please some one help me

PHP Fatal error:  require_once() enter code here[<a     href='function.require'>function.require</a>]: Failed opening required     '/include/tables.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in     /home2/uaeadver/public_html/include/include.php on line 14

what is this all about i am including the include.php also here

   $path=dirname(__FILE__);
   global $minimal;

   if(!file_exists($path.'/../config.php')) header("Location: install/");     
   require_once($path.'/../config.php');

   if(!isset($config_abs_path) || !isset($config_live_site))  header("Location: install/");

   require_once($config_abs_path.'/include/tables.php');

try if both files in same dir

require_once('include.php');

and use to exit dir ../ like

require_once('../include.php');

The way you try to get to your base directory is not really working or the file you try to include does not exist.

Use the function getcwd() to let return your current work directory if it helps.

Generally, you start your application from always the same path, you could define() an absolute base path and use that instead:

// define'd constants are always global scope:
define('BASE_PATH', '/home2/uaeadver/public_html/');

require(BASE_PATH . 'include/config.php');

Missing exit; after Location change:

if(!file_exists($path.'/../config.php')) {
    header("Location: install/"); 
    exit;
}

Your codestyle really needs improvement. Don't use globals, try real design patterns and strict coding standards.

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