httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GopiKrishnan Ganesan <swastikakrish...@gmail.com>
Subject [users@httpd] Apache CGI connectivity issue
Date Mon, 14 Feb 2011 07:58:21 GMT
Hi all,


I'm setting up a web server using the standard LAMP stack ( Fedora 14,
Apache 2.2 , MySQL 5.1.52, Python 2.7 ). I've written a Python CGI script
which connects to a MySQL server on other host. From a standalone python
script, I am able to connect to the MySQL server. However, as a CGI script,
the connection fails. Apache's error_log shows the following:

 [error] [client 10.239.70.12] Traceback (most recent call last):
 [error] [client 10.239.70.12]   File "/var/www/cgi-bin/temp.py", line 129,
in <module>
 [error] [client 10.239.70.12]     dataSource.Initialize()
 [error] [client 10.239.70.12]   File "/var/www/cgi-bin/temp.py", line 34,
in Initialize
 [error] [client 10.239.70.12]     self.iConnection    = MySQLdb.connect(
STOR_HOST, STOR_USER, STOR_PASS, STOR_DBSE )
 [error] [client 10.239.70.12]   File
"/usr/lib64/python2.7/site-packages/MySQLdb/__init__.py", line 81, in
Connect
 [error] [client 10.239.70.12]     return Connection(*args, **kwargs)
 [error] [client 10.239.70.12]   File
"/usr/lib64/python2.7/site-packages/MySQLdb/connections.py", line 187, in
__init__
 [error] [client 10.239.70.12]     super(Connection, self).__init__(*args,
**kwargs2)
 [error] [client 10.239.70.12] _mysql_exceptions.OperationalError: (2003,
"Can't connect to MySQL server on '10.245.18.74' (13)")

However, if I try to connect to mysql server in localhost instead of
connecting to a different host, the connection succeeds.

Still strange, I've written a simple utility in Python which imitates a HTTP
Server ( attached ). This simple server doesn't complain if a CGI script
inside it tries to connect to a mysql server at different host.

I am not sure whether this is a configuration issue / security issue. Please
advise on how to achieve connection to mysql server at different host within
Apache CGI.

Thanks
Gopi

Mime
View raw message