PHP errors are not showing in browser only page goes blank [closed]
I'm learning to set up my LAMP server. I'm in a stage where I'm trying to connect MySQL to PHP files. It's kinda hard to work out where the problem is considering that all I'm getting is a blank page. No error lines, nothing.
here's my block of code:
<?php
//connect to mysql
$con = mysqli_connect('localhost','root','vengaboys','shoutit');
//test the connection
if(mysqli_connect_errno()){
echo 'failed to connect to MySQL: '.mysqli_connect_error();
}
ini_set('display_errors', 'shoutit');
error_reporting(E_ALL);
?>
Initially, display errors in PHP are OFF. You have to turn it ON Manually.
Locate the following files.
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
Now find display_errors
in that page. It must be Off. You have to change it and make it On
.
Now restart the server.
sudo /etc/init.d/apache2 restart
An error will display instead of a blank page.