Do not use CGI-BINs cause they are vulnerable to some attacks. If you
use mySQL directly with the Apache Server to do queries you will
probably end up using PHP interface to communicate with mySQL Server.
Do noy install the PHP plug-in as a CGI-BIN but as a module.