Q:

my project in lamp not worked when i try to connect to database

i recently installed lamp on ubuntu and now i got problems with them (i think that can not connected to database)
I did the following tests :

i tested mysql with call phpMyAdmin and that's done :

phpMyAdmin screanShot

i tested php with phpInfo and that's done too :

phpInfo screanshot

i tested simple code for to test the database connection

my simple code this is :
<?php
//phpinfo();

$servername = "localhost";
$username = "root";
$password = "3cret";

// Create connection
$conn = new mysql($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
   die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";

?>

And the result was:

The localhost page isn’t working
localhost is currently unable to handle this request. 500

A:

This problem was due to disabled virtual Directory Support and that's solved with this command : 
sudo chmod -R 755 /var/www

