Jump to content
Larry Ullman's Book Forums

web1868

Members
  • Posts

    9
  • Joined

  • Last visited

web1868's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. hi i uploaded a website using the includes infrastructure exampled in this book my base uri for xamp is define ('BASE_URI', '/C:xamp/htdocs/'); and it works fine but im using filezilla to upload folders to my site hosting on go daddy and when i use my httpdocs path define ('BASE_URI', '/httpdocs/'); i get this error: PHP Fatal error: require(): Failed opening required '/httpdocs/mysql.inc.test.php' (include_path='.;.\includes;.\pear') in G:\PleskVhosts\axebs.com\httpdocs\index.php on line 16 any tips on what i need to set my path to to work on filezilla??
  2. hey man i just figured it out my apologies for all the issues.
  3. yea im running on windows 64 bit. so i deleted the slash in front of C: now my base_uri looks like '/C:xampp/htdocs/' and im still getting the error message An error occurred in script 'C:\xampp\htdocs\html\index.php' on line 15: require(/C:xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument Array( [0] => Array ( [file] => C:\xampp\htdocs\html\index.php [line] => 15 [function] => my_error_handler [args] => Array ( [0] => 2 [1] => require(/C:xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument [2] => C:\xampp\htdocs\html\index.php [3] => 15 [4] => Array if i use mu base uri 'C:xampp/htdocs/' "without the slash behind it" i get an exceed execution time error ive tried multiple uri combinations could there be something more than a simple uri error maybe a path environment variable issue?
  4. ?? in my require statement the slash is "behind" C because in the books it says our path should look like => '/path/to/web/folder/' in which case my path is 'C:/Xampp/htdocs/' in my script statement yes the slash "\"will be in front of C because its the physical file of my computer
  5. my code now looks like this and it pays to know Home About Contact Register An error occurred in script 'C:\xampp\htdocs\index.php' on line 7: require(/C:xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument Array( [0] => Array ( [file] => C:\xampp\htdocs\index.php [line] => 7 [function] => my_error_handler [args] => Array ( [0] => 2 [1] => require(/C:xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument [2] => C:\xampp\htdocs\index.php [3] => 7 [4] => Array ( [_GET] => Array ( ) [_POST] => Array ( ) [_COOKIE] => Array ( [sbOverlayID] => 51111639 ) [_FILES] => Array
  6. ok I see how that my cause an error but Ive deleted the slash in front and its still saying "failed to open stream"?
  7. the error is occuring in this code // Are we live? $live = false; // Errors are emailed here: $contact_email = '######@gmail.com'; // ************ SETTINGS ************ // // ********************************** // // ********************************** // // ************ CONSTANTS *********** // // Determine location of files and the URL of the site: define('BASE_URI','/C:/xampp/htdocs/'); define('BASE_URL', 'http://localhost:8080/'); define('MYSQL', BASE_URI. 'mysql.inc.php'); // ************ CONSTANTS *********** // // ********************************** // // ********************************* // // ************ SESSIONS *********** // // Start the session: session_start(); // ************ SESSIONS *********** // // ********************************* // // ****************************************** // // ************ ERROR MANAGEMENT ************ // // Function for handling errors. // Takes five arguments: error number, error message (string), name of the file where the error occurred (string) // line number where the error occurred, and the variables that existed at the time (array). // Returns true. function my_error_handler ($e_number, $e_message, $e_file, $e_line, $e_vars) { // Need these two vars: global $live, $contact_email; // Build the error message: $message = "An error occurred in script '$e_file' on line $e_line:\n$e_message\n"; // Add the backtrace: $message .= "<pre>" .print_r(debug_backtrace(), 1) . "</pre>\n"; // Or just append $e_vars to the message: // $message .= "<pre>" . print_r ($e_vars, 1) . "</pre>\n"; if (!$live) { // Show the error in the browser. echo '<div class="error">' . nl2br($message) . '</div>'; } else { // Development (print the error). // Send the error in an email: error_log ($message, 1, $contact_email, 'From:admin@example.com'); // Only print an error message in the browser, if the error isn't a notice: if ($e_number != E_NOTICE) { echo '<div class="error">A system error occurred. We apologize for the inconvenience.</div>'; } } // End of $live IF-ELSE. return true; // So that PHP doesn't try to handle the error, too. } // End of my_error_handler() definition. // Use my error handler: set_error_handler ('my_error_handler');
  8. An error occurred in script 'C:\xampp\htdocs\index.php' on line 7: require(/C:/xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument Array ( [0] => Array ( [file] => C:\xampp\htdocs\index.php [line] => 7 [function] => my_error_handler [args] => Array ( [0] => 2 [1] => require(/C:/xampp/htdocs/mysql.inc.php): failed to open stream: Invalid argument [2] => C:\xampp\htdocs\index.php [3] => 7 [4] => Array
  9. hi im a java/ newbie php developer. I recently bought your book and it has great content, but I an failed to open stream error. I have removed the path/to/dir with the correct value which is '/C:/xampp/htdocs/' and im still getting an error could there be something wrong with my path variable??
×
×
  • Create New...