Article ID: 1682, created on Feb 7, 2007, last review on Apr 25, 2014

  • Applies to:
  • Plesk for Linux/Unix



I have problem getting the PHP/Apache on the Plesk server to work with the external Mysql database. Connection from PHP scripts to the remote database always fails. However we can connect to the database server from SSH on the web server with "mysql -h hostname -u user -p". We made a small php script that simply tries to connect to the remote database. When running the php script in ssh on the web server it works just fine. But when running it under Apache we get a connection failure no matter what we do.



Please check if selinux is enabled in the system. If yes, try to disable it as described in 1636 or allow remote connections for Apache with:

# setsebool -P httpd_can_network_connect=1

There are other selinux restrictions which can affect the server in the future. You can get the full list with the command 'getsebool -a'.

29d1e90fd304f01e6420fbe60f66f838 a914db3fdc7a53ddcfd1b2db8f5a1b9c 56797cefb1efc9130f7c48a7d1db0f0c

Email subscription for changes to this article
Save as PDF