I have ran aptitude install php5-mysql
(and restarted MySQL/Apache 2), but I am still getting this error:
Fatal error: Call to undefined
I see that you tagged this with Ubuntu. Most likely the MySQL driver (and possibly MySQL) is not installed. Assuming you have SSH or terminal access and sudo permissions, log into the server and run this:
sudo apt-get install mysql-server mysql-client php5-mysql
If the MySQL packages or the php5-mysql package are already installed, this will update them.
UPDATE
Since this answer still gets the occasional click I am going to update it to include PHP 7. PHP 7 requires a different package for MySQL so you will want to use a different argument for the apt-get command.
sudo apt-get install mysql-server mysql-common php7.0 php7.0-mysql
And importantly, mysql_connect()
has been deprecated since PHP v5.5.0. Refer the official documentation here: PHP: mysql_connect()