Forum Moderators: phranque

Message Too Old, No Replies

500 Internal server Error

         

alexseif

1:21 pm on Jul 3, 2011 (gmt 0)

10+ Year Member



Hi all,
One if the things that I find time consuming and very disturbing is a 500 internal server error.
Since the error could be from a vast amount of reasons (code, apache conf, htaccess)
And sometimes its hard to debug I'd like to pin point easy strategies of solving this issue
Cheers
Alex Seif

alexseif

1:35 pm on Jul 3, 2011 (gmt 0)

10+ Year Member



Here is the htaccess for one of my projects: (egyptolution.com).
I can't seem to get the error log to work, as soon as i uncomment it, it produces a 500.
The main issue is that the website produces "no server response" almost randomly and I'd like to debug that, any pointers would be greatly appreciated.

ErrorDocument 404 /404.php
AddDefaultCharset UTF-8
AddHandler php5-script .php
AddHandler php5-script .html
AddHandler php5-script .xml
DirectoryIndex index.html index.php
Options +FollowSymlinks
RewriteEngine on
RewriteBase /


RewriteCond %{HTTP_HOST} ^egyptolution.com [NC]
RewriteRule ^(.*)$ http://www.egyptolution.com/$1 [L,R=301]

RewriteRule ^index.php http://www.egyptolution.com/home [NC,L]

# Rewrite URLs of the form 'x' to the form 'mod.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{REQUEST_URI} !=/rss.xml
RewriteRule ^(.*)$ mod.php?q=$1 [L,QSA]

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript

ExpiresActive On
ExpiresDefault "access plus 4 hours"
ExpiresByType application/javascript A900
ExpiresByType application/x-javascript A900
ExpiresByType text/javascript A900
ExpiresByType text/html A90
ExpiresByType text/xml A90
ExpiresByType text/css A900
ExpiresByType text/plain A62
ExpiresByType image/gif A14400
ExpiresByType image/jpg A14400
ExpiresByType image/jpeg A14400
ExpiresByType image/png A14400
ExpiresByType image/bmp A14400
ExpiresByType application/x-shockwave-flash A3600


#ErrorLog "errors.log"
#RewriteLogLevel 3
#RewriteLog "rewrite.log"

php_flag display_errors 1
php_value error_reporting 8191

g1smd

4:29 pm on Jul 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RewriteRule ^index.php http://www.egyptolution.com/home [NC,L]


The above code produces a 302 redirect AND an unwanted redirection chain for non-www index.php requests.

The rule must be moved so that it is BEFORE the non-www to www rule. You also need to escape the literal period in the index\.php part.

alexseif

4:53 pm on Jul 3, 2011 (gmt 0)

10+ Year Member



Thanx a lot g1smd,
I also changed the directory index to home, so hopefully i will remove this redirect when its all kicked out of the website.
But would you know of different reasons that a website just doesn't respond to a normal request header.
I've went through the code to make sure no false header/empty/premature headers are sent.
But still from time to time, it just stops responding and the loading circle of the browser just goes forever.

alexseif

5:16 pm on Jul 3, 2011 (gmt 0)

10+ Year Member



I'm sorry for the separate messages but I would also like to know how to log these calls

lucy24

9:15 pm on Jul 3, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



#ErrorLog "errors.log"

Does your host not let you see the ordinary error log? Try asking nicely. It normally lives in the same place as the access log and you don't need to do anything extra to create one. If you're trying to override something that was set at the uber-htaccess level, things may begin to melt down.

Matter of fact, if I'm reading Apache [httpd.apache.org] right, you're not allowed to put an ErrorLog directive in .htaccess. It has to be in the configuration file.

alexseif

10:17 am on Jul 4, 2011 (gmt 0)

10+ Year Member



Thanx lucy24, but, I can only generate a php error log, but I don't have an access log also, I will try with my service provider.
Thanx again all, you've been a great deal of help, I hope I can give back one day :)