Symptoms
-
A website hosted on a Plesk server shows the error:
Call to undefined function mysql_connect()
-
The following error is shown in the Plesk menu Domains > example.com > Applications > Manage Available Applications > application_name:
Warning: The app was not configured: Non-zero exit status returned by script. Output stream: 'PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /usr/local/psa/var/apspackages/apscatalogJB3Muy.zip33615037-b2fc-e2/cache/scripts/db-util.php:66
-
On Plesk for Windows, the following error is found in the menu Domains > example.com > Logs:
500 PHP Fatal error:Uncaught Error:Call to undefined function mysql_connect()...
Cause
The PHP function mysql_connect()
was removed in PHP 7.0.0.
Resolution
Plesk on CentOS/RHEL/CloudLinux/Virtuozzo Linux 7 and on Windows Server
-
Go to Domains > example.com > PHP Settings.
-
Switch PHP version to 5.x:
Note: If PHP 5.x is not available for selection, install it using Plesk Installer.
Plesk on other Linux OS (CentOS/RHEL/CloudLinux 8, Debian 9/10, Ubuntu 18.04/20.04, AlmaLinux)
On these operating systems, PHP 5.x (and, in some cases, PHP 7.0) cannot be installed because system libraries are not compatible with these outdated and not supported PHP versions.
In this case, use one of the below solutions:
-
Contact website developer to adjust the website code for a supported PHP version.
-
Try installing PHP 5.x as a custom PHP version at your own risk.