Centos Error 500 Internal Server Error

Hi All,

I am trying to troubleshoot an error that I am getting on our web server.  Our PHP does a SQL query and is supposed to create a table with the results.  

If I print the SQL query (print "sql=".$sql."<br/>";) from the PHP page then everything works.  If I remark out the print then I get an Internal Server Error.  It doesn't make since that it works if I print the query

I am not sure where the logs but I did enable PHP error logging (/var/log/error_php.log) and nothing is being logged.  

Thank you for all of your help in advance
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dan CraciunIT ConsultantCommented:
500 is a server error. Should be in the apache logs.

thomasm1948Author Commented:
I am unable to find the apache logs for centos.  I tried locate and cannot seem to find them
Dan CraciunIT ConsultantCommented:

To find the error log, you can use
grep ErrorLog /etc/httpd/conf/httpd.conf
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

thomasm1948Author Commented:
ok I think I found them in /etc/httpd/logs

What should I be looking for
Dan CraciunIT ConsultantCommented:
Look in error_log. That's where all the errors are recorded.
thomasm1948Author Commented:
Ok, I just to recreated the issue and there is nothing logged for the the 500 error
thomasm1948Author Commented:
OK i was being impatient and it did log it.  This is what I am getting

[Mon Sep 28 15:12:15 2015] [warn] mod_fcgid: process 27722 graceful kill fail, sending SIGKILL
[Mon Sep 28 15:12:21 2015] [notice] mod_fcgid: process /var/www/vhosts/mysite.com/httpdocs/index.php(27722) exit(communication error), get stop signal 9

I am not to sure what this means
Dan CraciunIT ConsultantCommented:
Put this at the beginning of your script:

Then see if you get the errors printed in that page.
Dan CraciunIT ConsultantCommented:
You might have a problem with the resources.
FastCGI dies badly when out of RAM or out of time.

Can you post the phpinfo() output (masking whatever private info you need)?
thomasm1948Author Commented:
That's weird....I placed that in my code and now it works as it should.

I wonder why it would start working.  I know that the script is kind of slow being that it loops through the results and creates individual tables for each results.  So I increased the time out for both the php.ini and httpd.conf files but even then it was not working
Dan CraciunIT ConsultantCommented:
You might want to refactor your code to make it run faster or increase the timeouts a lot, or you'll get those errors unexpectedly  (for ex when background jobs run and slow down your server).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thomasm1948Author Commented:
Excellent thank you for all of your help
Dan CraciunIT ConsultantCommented:
You're welcome.

Glad I could help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.