You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by GopiKrishnan Ganesan <sw...@gmail.com> on 2011/02/14 08:58:21 UTC
[users@httpd] Apache CGI connectivity issue
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