Articles in this section

Website hosted on Plesk server does not work after switching to PHP 7.x: Call to undefined function mysql_connect()

Plesk for Windows Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

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
  1. Log into Plesk.

  2. Go to Domains > example.com > PHP Settings.

  3. Switch PHP version to 5.x:

    PHP_Settings.png

    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:

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.