Yesterday i found a peculiar problem. We have just transferred our application from our local server to another server. But after that this application wasn’t working properly
.
Anyway, we have tried to locate the problem and found that it wasn’t connecting to the replica database (another mysql database) properly. But most interesting thing was i was successful to connect from command prompt using ssh using same connection parameter.
Then i wrote an script to test the connection and found that i can’t connect to remote database using mysql_connect X(
Anyway, after surfing a lot i’ve found a solution to solve the problem.
Open your my.cnf which is placed in /etc/ directory and find the following line.
bind-address=127.0.0.1
It allow only localhost to connect. So delete or comment out this line. It will solve the problem
But my porblem wasn’t that. infact that line wasn’t exist in my my.cnf file. Problem was with the extra security that apache provide now a days. apache doesn’t allow connetion to other network by default. So follow the instruction to activate network connection.
At first, verify that SELinux is enabled or not.
in order to varify type in your command prompt getenforce
You should see something like Enforcing
If you see a different result, type setenforce 1 in the command prompt
If you get an error, then you do not have Selinux turned on. Go to /etc/selinux/config and edit the config file to enable Selinux.
Now reboot the linux server
Once SELinux is enabled, do the following
Set SELinux to allow remote connections for HTTP
setsebool -P httpd_can_network_connect=1
Tha’ll do the trick.
#1 by Tamiflu - May 2nd, 2009 at 03:06
It is the coolest site,keep so!
#2 by Anonymous - September 17th, 2009 at 00:48
The Regard, all this it is enough interesting.