Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^2: Perl and Mysql logs

by PierreForget (Novice)
on Mar 19, 2013 at 14:11 UTC ( #1024305=note: print w/replies, xml ) Need Help??

in reply to Re: Perl and Mysql logs
in thread Perl and Mysql logs

Hi and thank you for the reply.

The clientpreno is a voluntary mistake, so that the system will generate a Mysql error. Otherwise, the Perl script gets executed without generating any error. The purpose is to be able to get Mysql errors when there is an error in the code. Actually, I am not able to debug the Mysql code in Perl, because it doesn't generate any Mysql error when the script is called from a browser. If it's called from root, I get the Mysql error. If it's called from root with a chroot, I still get the error.

Called from root:

perl /httpd/domainname/cgi/ DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at /httpd/domainname/cgi/ line 22.

Called from root with a chroot:

chroot /httpd perl /httpd/domainname/cgi/ DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at /httpd/domainname/cgi/ line 22.

Called from a browser (results from the Apache logs):

No errors in the logs and the page is shown in the browser.

Just like I said in the previous post, if I make a Perl error, I get the usual "Premature end of script headers".


Replies are listed 'Best First'.
Re^3: Perl and Mysql logs
by PierreForget (Novice) on Mar 19, 2013 at 18:30 UTC

    Hi, I found something new.

    I finally found where Apache is sending the Mysql logs. It is sending it directly to the main Apache logs, instead of the local vhost logs, although the directive in httpd.conf is local:

    Errorlog "/httpd/restaurant-quebec/logs/error_log"

    Here is the log in /httpd/usr/local/apache2/logs

    DBD::mysql::st execute failed: Unknown column 'clientpreno' in 'field +list' at line 22.

    So, it's not a Perl problem, but an Apache problem. I will continue my search and I will post the results once I find the issue, so that people who search for the same problem will have a solution.

    Thanks to everybody who took the time to read and reply.

      Hi everybody,

      I finally found the solution. In Apache, the newer version with "event" threading has the side-effect of logging everything in the main server log file. It seems to be that the errors are sent to stderr and stderr can only be redirected to the main server error log file.

      The workaround that was suggested to me in the was to recompile with the following switches (added to all the other switches I used):

      --with-mpm=prefork --enable-cgi

      Making sure I was using mod_cgi instead of mod_cgid in the modules section of httpd.conf

      If you look in the Apache documents, it tells you that the error log is redirected to the vhost file if the line exist in the vhost section:

      ErrorLog "/httpd/domainname/logs/error_log"

      But that is not true if you use mod_cgid. Only true if you use mod_cgi.

      Quite funny that you have to revert to older ways to get back your logs in the right place.

      Hope this help other people with the same problem.

      Thanks again to all the people who took the time to read or respond.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024305]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-05-20 14:30 GMT
Find Nodes?
    Voting Booth?