httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GopiKrishnan Ganesan <>
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] Traceback (most recent call last):
 [error] [client]   File "/var/www/cgi-bin/", line 129,
in <module>
 [error] [client]     dataSource.Initialize()
 [error] [client]   File "/var/www/cgi-bin/", line 34,
in Initialize
 [error] [client]     self.iConnection    = MySQLdb.connect(
 [error] [client]   File
"/usr/lib64/python2.7/site-packages/MySQLdb/", line 81, in
 [error] [client]     return Connection(*args, **kwargs)
 [error] [client]   File
"/usr/lib64/python2.7/site-packages/MySQLdb/", line 187, in
 [error] [client]     super(Connection, self).__init__(*args,
 [error] [client] _mysql_exceptions.OperationalError: (2003,
"Can't connect to MySQL server on '' (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.


View raw message