First time user of mysql and php here.
Apache2 is up and running. PHP5 is up and running. MYSQL is up and running; however, when I try to connect to my database I created, i receive a "server error" message with Chromium. With Firefox, there is just a blank page that displays, no error message. The code I've written should spout out an error on the page, but I'm getting a browser "Server error" message instead.
Any ideas?
<?php
$con=mysqli_connect('localhost', 'root', 'pass', 'db1');
if (mysqli_connect_errno($con)){
echo 'failed to connect: ' . mysqli_connect_error();
}
?>
I'm very confused, because i checked to make sure the mysql server was running, and I double checked my login information as well as database name. I can make changes and create databases from the mysql shell within terminal, but not through PHP!
I'd also add that PHP is working with the Apache server. If i change my code to something like phpinfo(), it works. It's only connecting to mysql that seems to be the problem.