Error establishing a database connection when swithc to additional PHP

Created:

2016-11-16 13:07:14 UTC

Modified:

2017-04-24 11:11:17 UTC

0

Was this article helpful?


Have more questions?

Submit a request

Error establishing a database connection when swithc to additional PHP

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk 11.0 for Windows
  • Plesk 12.0 for Linux

Symptoms

  1. I installed second PHP 5.4 on server and switched domain to use it.
  2. Now when I open Wordpress on domain, I got error:

    Error establishing a database connection
  3. If I switched back to PHP53, Wordpress works.

Cause

Default mysql socket is not specified in php.ini for additional PHP.

Resolution

  1. Make sure that default mysql socket is specified in php.ini:

    grep -ir mysql.sock /usr/local/php540-cgi/php.ini |grep -v ';'
    mysql.default_socket = /var/lib/mysql/mysql.sock
  2. Switch PHP version on domain after changes in main php.ini file.

Have more questions? Submit a request
Please sign in to leave a comment.