[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

500 Internal Server Error with no trace?

Posted on 2013-11-14
11
Medium Priority
?
654 Views
Last Modified: 2013-11-21
Hello Experts!

I was wondering if some of you might be able to lend me a hand to find out the cause why I end up with 500 Internal Server errors when I run my php script which transfers photos from another server.

I have run this script and when the error occurs, I check the server error logs and there is nothing registered.  I have PHP error reporting turned on.

How can I find out the cause of these errors?
0
Comment
Question by:OmniUnlimited
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 39648912
By error logs you mean Apache's error.log ?
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39649090
Yes.
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39649705
Unfortunately, a 500 Server Error is fairly un-specific, and could be caused by a number of things. Can you run another PHP script (just a basic one) in the same folder? Is there a way for you to comment out some of the functionality of your script, to try and isolate the problem? Are you using htaccess for any rewrites?

If you're not getting any logs in the error files, this is probably easiest solved as a process of elimination.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39649875
@ChrisStanyon:

Thanks for the reply.  I am aware that a 500 server error is fairly un-specific, and could be caused by a number of things, but why wouldn't such an error register in the logs?  I would think that the people who design these things would set up all server errors so that they would log.

The problem with your idea of commenting out some of the functionality of the script is that I am not getting any error messages on the server, so isolating the area where the problem is does me no good as far as helping me to determine the cause (I know which part of the script is causing the problems, BTW).

This is just a one page function to draw images from another server.  .htaccess is not involved.
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39649892
If the error is critical, it may break the server enough that it's not able to write to the logs.

If you know which part of the script is causing the problems, then you're half way there. Post up the problem code and we'll have a look.
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39650134
@ChrisStanyon:

While I understand completely your desire to see the code (I am certain you are assuming the problem lies in the code), you should know that what is happening is that the script is breaking in the middle of an echo statement.  It prints out part of the text (which is a url for debugging purposes) and then breaks with an
Internal Server Error.  

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, non@na.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Open in new window


You should also know that upon repeated runs of the script, the break point is not consistent, i.e. it will break in different points along the string.

Therefore, I need to clarify what it is that I was saying when I said, "I know which part of the script is causing the problems"  I meant to say that "I know where in the script the program is breaking" not, as I erroneously stated, where the problem is occurring.
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39650614
Hey OmniUnlimited,

If you can run another script on your server in the same folder, then it's highly likely that your current script is breaking and causing the 500 error (nowhere in the error you posted mentions 500). If you can't run another script then maybe it's a server issue.

PHP parses a document fully before outputting to the browser, so it does seem odd that you're getting part of an echo statement out. Normally, a 500 error happens and PHP won't output anything.

It does mention that the problem is on the na.com server. Is this your server, or the remote one you're trying to pull data from.

Without seeing code, I could spend all day just guessing, so unless you can post code for us to test, there nothing else I can do.

As I said, you could try isolating parts of your code to see if that solves the problem. If your code is written robustly enough to handle unexpected errors, then you should be able to resolve it.
0
 
LVL 17

Author Comment

by:OmniUnlimited
ID: 39650902
Hey ChrisStanyon:

nowhere in the error you posted mentions 500

The text of the error message is the stuff that appears on the web page.  The browser title bar is where I see the "500 Internal Server Error".

If you can't run another script then maybe it's a server issue.

I can actually run to completion the script that keeps breaking if the amount of the data I am pulling from the other server is small.  I am using curl to pull the image files and the echo statement that gets cut off is found on the line just before the curl statements.  I am thinking that somehow in the pulling of information from the other server something is happening to cause the error and stops the output of the script in mid-stream.  Do you know of a method that will allow me to see errors that occur during a curl file access?

Is this your server, or the remote one you're trying to pull data from.

The email address is from my server.

If your code is written robustly enough to handle unexpected errors, then you should be able to resolve it.

I have error reporting turned on and set to E_ALL, yet I still get no record of any errors in the log.
0
 
LVL 44

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 39650957
OK. Now we're getting somewhere. Only large files cause the problem! What size is considered large?

You still seem reluctant to show any code, or to isolate the problem, so this is turning into a quiz - each time I ask a question, you give a little more information - we could be at this for days.

Create a script to pull in 1 large file and see if that bombs. cURL has lots of options, so read the manual and make sure you're set up right.

When I say robust, I mean coding in such as way as to deal with issues if they arise (try/catch, error functions etc). I don't think it would necessarily solve your problem, but it would allow better tracking. You might also want to do plenty of var_dumps while debugging your code.

For curl errors, see the curl_error() function:

http://us2.php.net/curl_error

Turning error reporting on and set to E_ALL will show the errors, but doesn't specify whether to log them. Run phpinfo() on your server and make sure display_errors is ON and error_log is set to a valid path and not commented out. Edit your php.ini file if you need to change the settings.

You can always check if errors are being logged with this:

<?php error_log("Testing the error logging") ?>

Then check your log file.
0
 
LVL 17

Author Closing Comment

by:OmniUnlimited
ID: 39666787
Perfect!  In following your instructions and making the script more robust, and activating error reporting and an error log path in php.ini, I was able to achieve logging of the events which pointed me to a misconfiguration in the mod_fcgid file.

Thanks a million.
0
 
LVL 44

Expert Comment

by:Chris Stanyon
ID: 39666937
Glad you got it - debugging is sometimes a bit of a dark art :)
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question