PHP includes unable to find file.

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP includes unable to find file.

Postby wastvedt » 09. August 2004 20:02

Hi!
I'm using xampp on windows XP, and am writing a page for a form that includes a database connection script:

Code: Select all
require_once ('../mysql_connect.php') or die ('Could not connect to the database: ' . mysql_error() );


When I ran the page the form displayed, but I got this error at the place in the form where the include was called:

Warning: main(../mysql_connect.php): failed to open stream: No such file or directory in C:\TrygLand\Utilities\xampp\htdocs\websites\bandsite\submit_photos.phpon line 47

Fatal error: main(): Failed opening required '../mysql_connect.php' (include_path='.;C:\TrygLand\Utilities\xampp\php\pear\') in C:\TrygLand\Utilities\xampp\htdocs\websites\bandsite\submit_photos.phpon line 47


Just a few minutes ago I was messing around with file locations and syntax to try to get the page to work properly, and when I deleted the 'or die' part of the require_once, the page worked fine. I have no clue why that worked, and would like to be able to use error reporting in future sites, so any help anyone could provide would be great.

Thanks again,
wastvedt :D
wastvedt
 
Posts: 6
Joined: 09. August 2004 19:34
Location: Pennsylvania, US

Postby Wiedmann » 09. August 2004 20:39

@(require_once('../mysql_connect.php')) or die('Could not read required file \'../mysql_connect.php\'!');

inside mysql_connect.php:
$link = mysql_connect($host, $user, $pass) or die('Could not connect to the database: '.mysql_error());
Last edited by Wiedmann on 11. August 2004 09:08, edited 1 time in total.
Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Thanks

Postby wastvedt » 11. August 2004 01:31

Thanks for the quick reply! That worked perfectly.
wastvedt :D
wastvedt
 
Posts: 6
Joined: 09. August 2004 19:34
Location: Pennsylvania, US


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 44 guests