- Plesk 11.x for Windows
- Plesk 12.0 for Linux
- Plesk 12.5 for Linux
- Plesk for Linux
- PHP 5.6 is installed on server and set for a domain.
Attempt to open a website in a browser produces the error:
Error establishing a database connection
The website works as expected when another PHP version is used.
Default mysql socket is not specified in php.ini for additional PHP.
Make sure that default mysql socket is specified in php.ini in Plesk > Tools & Settings > PHP Settings > PHP 5.6:
Also it can be done via command line. Connect to the server via SSH and add the following line in the corresponding
# grep -ir mysql.sock /opt/plesk/php/56/etc/php.ini |grep -v ';'
mysql.default_socket = /var/lib/mysql/mysql.sock
Switch PHP version on domain in Plesk > Domains > example.com > PHP Settings after changes in main php.ini file.