Jump to content

500 Error but nothing in error_log


StefanRSA

Recommended Posts

Hi, I receive 500 server errors on my system for a certain page.

When I go into the error_log nothing is in the log about the error.

 

On top of the page I have:

set_time_limit (0); 
error_reporting(E_ALL ^ E_NOTICE);

 

My php.ini

display_errors is off

display_startup_errors is on

error_reporting is  E_ALL & ~E_NOTICE & ~E_DEPRECATED

 

How can I get the system to show me where the errors are? Am I missing anything?

Link to comment
Share on other sites

Thanks for replying Requinix.

 

The system I am working on is live... Cannot display errors onscreen...

I am looking at both error_log in cPanel and log_error.doc in folder.

Where else should I look?

Link to comment
Share on other sites

The site uses sphider as search.

In the root folder of sphider system the .htaccess reads

#   1. prevent listing of folders
Options  -Indexes
#
#   2. Redirect client enquiries to search.php
RewriteEngine on
RewriteRule ^search\.html$ ./search.php
#
#   3. Always start with this file
DirectoryIndex search.php
#
#   4. Prevent delivery of .htacess file 
<FilesMatch "^.htaccess" >
deny from all
</FilesMatch>
#
#   5. Enable Apache to use php includes
AddType application/x-httpd-php .htm .html
#
#   6. Unset Magic quotes
php_flag magic_quotes_gpc off 
#   End of file

 

It also has a php.ini file that reads:

allow_url_fopen = on;

Link to comment
Share on other sites

"display_errors" and "error_reporting" are for PHP-level errors, not Apache server errors. Generally the two aren't related, but there's certain situations where PHP code could cause a server error. Infinite redirect loops are a common cause for getting an odd 500 error, and bad rewrite rules / server configuration as I think jonsjava is getting at. Also remember that Apache's error log is not the same as the PHP error log. What do you actually do in the code behind this page that doesn't work?

Link to comment
Share on other sites

It is the sites search page.

The strange thing is that the error happens only with certain words or search phrases searched for.

 

If you search for "Car for Sale" all is fine....

If you search for a word not in the index all is fine....

If you search for "spa bath" the error kicks in. I was thinking the error_log could help me... But no entry is written into the error_log and the page load halfway and exits.... 500 Error

 

Link to comment
Share on other sites

Mmmm... Not sure where to look and if I would look at the right log?

 

Was thinking the cPanel log or error_log file in the search system folder will help...

 

Where do I look for the Apache error log?

 

I had the system once earlier today displaying results... Strangely...

After the search is done the cache for the search actually shows results that should have displayed....

$wr_handle = fopen ("".$textcache_dir."/".$cache_query."_".$type."_".$category.".txt", "r");

Link to comment
Share on other sites

I couldn't say to be honest, I don't use cPanel. Do you have SSH access to the server? I'd guess that if the search is working on and off, the server doesn't like what it's doing (albeit performance issues, high memory usage, etc.) and is failing occasionally. What kind of hosting do you have?

Link to comment
Share on other sites

you should have a ~/logs or ~/var/log directory. find that, and in there, you should have httpd or apache folder

in that folder, you should have error.log

 

also, you should have a ~/php or ~/var/log/php directory

 

Those are specific to your hosting provider, likely a shared hosting, which is why they've been set-up within your home directory ("~/") as you won't have access to the root directories.

 

On a dedicated server StefanRSA, you'll probably have the normal paths to the log files. Unfortunately that can vary between Unix distributions, so you may need to look around a bit. You should be able to find the Apache files within /etc/httpd/ or /etc/apache2, which should have an alias to the logs directory. In there you should be able to find the Apache error log.

 

Edit

 

If not you can use the grep or find commands to find the file.

Link to comment
Share on other sites

If you have SSH access, to prevent you having to download a 45mb log file, just use:

 

cat error_log | less

 

That will show you the first x lines of the log (x depending on the size of your screen) so you'll be able to tell first if it's the right one.

Link to comment
Share on other sites

Okay, right.. cd to the Apache directory within /etc/ and run the following grep search:

 

grep -r ErrorLog *

 

That should find the ErrorLog directive which contains the path to the server's error log.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.