Web applications on xen machine cannot connect to databases [SOLVED]
Turns out I forgot about SELinux (again).
Running Code:
setsebool -P httpd_can_network_connect_db on /etc/php.ini: allow_url_include = Off to On. (by the way, if anyone knows how I can get the word wrap working on this post please let me know as I have no idea) I'm having an issue where web applications running on apache, on a xen machine, cannot connect to databases over the network. The configuration is a server running Fedora Core 6, on this server is a Xen machine running Fedora 9. This xen machine was installed with virt-install. I don't know a lot of networking so it's whatever the default install did, I believe it connects directly to the router through the server's eth0 device using multicast (they both have their own IP and the router sees both machines as separate). The essence of the problem is thus, I can write a script, in either php or python which connects to either a mysql or postgresql database on the server. Run from a bash terminal those scripts both run and connect fine, however, put those scripts into web application and neither script can connect to the server. I've run wireshark on the server and confirmed that no packets are showing up there when the web apps try to make the connection. In fact I replicated the databases onto the xen machine itself, if I try to connect to the localhost through either 192.168.1.5 or even 127.0.0.1 it again fails, however using 'localhost' instead of '127.0.0.1' works (note as usual everything works through the command line). I'm pretty sure this isn't a problem with the apache configuration since I have a laptop running F9 and I went as far as copying over the entire /etc/httpd from the xen machine to the laptop and the laptop was still able to run the web apps properly and connect to the databases. I was wondering if anyone had any idea what was going on or how to fix this? Thanks, Aaron A sample line from the apache error_log Code:
[Sun Jul 06 16:58:47 2008] [error] [client 192.168.1.2] PHP Warning: mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on '192.168.1.4' (13) in /var/www/html/test.php on line 2 PHP Code:
Code:
[root@web ~]# route |
$link = mysql_connect('192.168.1.4','foo', 'bar);
I think you have to put an "'" after "bar"...... i.e. the line should be: $link = mysql_connect('192.168.1.4','foo', 'bar'); |
Quote:
|
All times are GMT -5. The time now is 09:09 PM. |