rwigs Posted May 22, 2015 Share Posted May 22, 2015 When I have the following line in my php file I only get HTTP 500 error when trying to view the page: require_once('dbConnection.php'); The contents of dbConnection.php are: <?php /* Database connection information */ $gaSql['user'] = "myuser"; $gaSql['password'] = "mypassword"; $gaSql['db'] = "mydatabase"; $gaSql['server'] = "localhost"; $db_conx = mysqli_connect( $gaSql['server'], $gaSql['user'], $gaSql['password'],$gaSql['db'] ) or die( 'Could not open connection to server' ); // Evaluate the connection if (mysqli_connect_errno()) { echo mysqli_connect_error(); exit(); } ?> If I comment out the require_once line then the page works (well, it won't do the database connection parts, but I get the form and not HTTP 500. Any reason why this shouldn't work? Quote Link to comment https://forums.phpfreaks.com/topic/296451-getting-http-500-error-with-include/ Share on other sites More sharing options...
Solution requinix Posted May 22, 2015 Solution Share Posted May 22, 2015 Have you checked your error logs yet? Quote Link to comment https://forums.phpfreaks.com/topic/296451-getting-http-500-error-with-include/#findComment-1512461 Share on other sites More sharing options...
Ch0cu3r Posted May 22, 2015 Share Posted May 22, 2015 To see why you are getting that error enable error reporting/display errors with the following two lines at the top of your code ini_set('display_errors', 1); error_reporting(E_ALL); The other way to find out the error message is to check your servers error logs. Quote Link to comment https://forums.phpfreaks.com/topic/296451-getting-http-500-error-with-include/#findComment-1512462 Share on other sites More sharing options...
rwigs Posted May 22, 2015 Author Share Posted May 22, 2015 Thanks! The simplest things... I hadn't thought to check error logs because I didn't really know how to check them on local machine. But I found them and found that I had an undefined class in index.php. That fixes one problem, now on to the next (which I will make a new post for). Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/296451-getting-http-500-error-with-include/#findComment-1512464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.