rbjordens Posted September 11, 2012 Share Posted September 11, 2012 HI all I am having nubie probs... loaded the completed files as per book onto my web host... get following message... Warning: require(./includes/config.inc.php) [function.require]: failed to open stream: No such file or directory in /websites/123reg/LinuxPackage21/bl/yt/t_/blytt.co.uk/public_html/index.phpon line 2 Warning: require(./includes/config.inc.php) [function.require]: failed to open stream: No such file or directory in /websites/123reg/LinuxPackage21/bl/yt/t_/blytt.co.uk/public_html/index.phpon line 2 Fatal error: require() [function.require]: Failed opening required './includes/config.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in/websites/123reg/LinuxPackage21/bl/yt/t_/blytt.co.uk/public_html/index.php on line so I check my files as per error message and can't see any problems...can anyone help here? on the Index.php <?php require ('./includes/config.inc.php'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { include ('./includes/login.inc.php'); } include ('./includes/header.html'); on the config.inc.php i pressume the problem is highlighted as per green text? <?php $live = false; $contact_email = 'ross@blytt.co.uk'; define ('BASE_URI', '/public_html/html/includes/'); define ('BASE_URL', 'www.blytt.co.uk/'); define ('PDFS_DIR', BASE_URI . 'pdfs/'); // Added in Chapter 5. define ('MYSQL', BASE_URI . 'mysql.inc.php'); session_start(); function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { global $live, $contact_email; $message = "An error occurred in script '$e_file' on line $e_line:\n$e_message\n"; $message .= "<pre>" .print_r(debug_backtrace(), 1) . "</pre>\n"; if (!$live) { // Show the error in the browser. echo '<div class="error">' . nl2br($message) . '</div>'; } else { // Development (print the error). error_log ($message, 1, $contact_email, 'From:admin@example.com'); if ($e_number != E_NOTICE) { echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div>'; } } return true; // So that PHP doesn't try to handle the error, too. } set_error_handler ('my_error_handler'); function redirect_invalid_user($check = 'user_id', $destination = 'index.php', $protocol = 'http://') { if (!isset($_SESSION[$check])) { $url = $protocol . BASE_URL . $destination; // Define the URL. header("Location: $url"); exit(); // Quit the script. } } Any help much appreciated. many thanks ross Link to comment Share on other sites More sharing options...
margaux Posted September 11, 2012 Share Posted September 11, 2012 You're right in that its your file structure. If your root directory is public_html and includes is one below the root, I would think that define ('BASE_URI', '/public_html/html/includes/'); should be define ('BASE_URI', '/public_html/'); and require ('./includes/config.inc.php'); should be require ('includes/config.inc.php'); You may need to change all your require and include statements. Link to comment Share on other sites More sharing options...
Recommended Posts