Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/pleskhosts.com/httpdocs/forum/includes/init.php on line 49

Allow Apache to connect to remote DB Server using SELinux [Archive] - Forums

View Full Version : Allow Apache to connect to remote DB Server using SELinux


speedy
07-05-2007, 07:38 AM
Taken from http://kb.swsoft.com/en/1682

SYMPTOMS:
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. RESOLUTION:
Please check if selinux is enabled in the system. If yes, try to disable it as described in 1636 (http://pleskhosts.com/forum/../article_172_1636_en.html) 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'.


Transfer a Domain Name $9.99
Register A Domain Name  $9.99
www.