添加`mysql_connect()`后,PHP脚本无法运行

i have installed Linux Mint 18.1, then LAMP server using the command sudo apt-get install lamp-server^ , for testing i tried to create a script connecting to MYSQL database, just like the following.

<?php
$h = "localhost";
$u = "root";
$p = "password";
$conn = mysql_connect($h,$u,$p);

echo "test";

?>

when i remove the line $conn = mysql_connect($h,$u,$p); the script works fine, otherwise it isn't running, php5.6-mysql is already installed , and i also tried to connect using mysqli_connect() instead of mysql_connect() i don't know what's wrong ?!

Paste this at the top of your file:

error_reporting(E_ALL);
ini_set('display_errors', 1);

It will help you to see the exact error. Alternatively, you can try:

$conn = mysql_connect($h,$u,$p) or die('Connection Error');

If connection is not getting established then it will show Connection Error