Hello, Everyone. I'm having problems with my CGI executable on my site. It gives HTTP 500 Internal Server Error while I have no access to any detailed logs to be able to troubleshoot the problem. It works well on my computer. The permissions of the file are set correctly (755). And another "Hello, World!" CGI program works perfectly on the server. It seems to me that this is a linking issue. Here are the details of the executable: The executable is linked with the following libraries: Source Code:
#include <iostream>
#include <mysql.h>
using namespace std;
const string CRLF = "\r\n";
int main()
{
cout << "Content-Type: text/plain" << CRLF << CRLF;
cout << "Hello, World!" << CRLF;
try
{
cout << "MySQL Client Version: " << mysql_get_client_info() << CRLF;
}
catch(exception& ex)
{
cout << "ERROR: " << ex.what() << CRLF;
}
return 0;
}
Compiled Using: gcc 4.7 with the following specifications: Makefile:
#Variables:
INCLUDE_DIR = -I/usr/local/mysql/include
LIBS_DIR = -L/usr/local/lib64
STATIC_LIBS = -lmysqlclient
DYNAMIC_LIBS = -ldl -lpthread -lrt
STATIC_LINK_FLAG = -Wl,-Bstatic
DYNAMIC_LINK_FLAG = -Wl,-Bdynamic
LD_FLAGS = $(LIBS_DIR) $(STATIC_LINK_FLAG) $(STATIC_LIBS) $(DYNAMIC_LINK_FLAG) $(DYNAMIC_LIBS)
#Rules:
test.cgi: test.cpp
g++ test.cpp $(INCLUDE_DIR) $(LD_FLAGS) -o test.cgi