I am new for PHP.Getting "MySQL server has gone away" error when i try to connect server using PHP. I can able access database with same credential in MySQL workbench. So, there is no problem in credentials.
$servername = 'localhost';
$username = 'root';
$password = '';
$dbname = 'moodle';
$conn = mysql_connect($servername, $username, $password,$dbname);
Please suggest your solution.
What I have tried:
Googling for this error must of them suggest to set maximum for timeout . I tried that one. But not resolved.