Page 1 of 1

CGI and MySQL in LAMPP

PostPosted: 11. July 2008 00:13
by Redlet
Hi,

I've written a small CGI application which tries to connect to a MySQL server. The application writes "Success" on the standard output if the connection is succesful or "Failure" if the connection fails.

When I execute the application in a console (/opt/lampp/cgi-bin/test.cgi), "Success" is written. This shows my program and the MySQL server are both OK. When I call the CGI application from a browser (http://myserver/cgi-bin/test.cgi), "Failure" is written. The problem is libmysqlclient.so can't be loaded for a reason I don't understand. The user who runs Apache is allowed to run the application and I added "SetEnv LD_LIBRARY_PATH /opt/lampp/cgi-bin" in /opt/lampp/etc/httpd.conf (/opt/lampp/cgi-bin is the directory where libmysqlclient.so is copied).

Where does the problem stem from ? Any idea ?

Many thanks in advance.

PostPosted: 11. July 2008 01:03
by Wiedmann
The problem is libmysqlclient.so can't be loaded

How did you know this?

PostPosted: 11. July 2008 07:41
by Redlet
Hi Wiedmann,

Thanks for your interest.

I know the problem is libmysqlclient.so can't be loaded because I added some code in my program to manage exception. Do you know FreePascal ?

Code: Select all
try
  ...
  Connection.Open;
  ...
  WriteLn ('Success' + '<br/>');
except
  on E: Exception do
  begin
    WriteLn ('Failure' + '<br/>');
    WriteLn (E.Message + '<br/>');
  end;
end;


So I get the error message which is :
Can not load MySQL library "libmysqlclient.so". Please check your installation.

When I execute the program from a console, "Success" is written.
Any idea ?

Thanks again for your interest.

PostPosted: 15. July 2008 08:28
by Redlet
No idea ? Anybody ?