简体   繁体   English

update-php类导致500内部服务器错误

[英]update-php class causing 500 internal server error

update -now apache is not giving any error. 更新-现在apache没有给出任何错误。 i have seen this earlier also. 我也很早就看到了。 99% times it will throw error 500 .see this screenshot. 99%次它将引发错误500。请参阅此屏幕截图。 it shows no error at all. 它根本没有显示任何错误。

http://imgur.com/a/vYwtA http://imgur.com/a/vYwtA

i dont know how to solve this problem. 我不知道如何解决这个问题。 it will again start showing after sometimes 有时过后它将再次开始显示

i have created one page which seems to be normal page when we open but in chrome and mozilla it gives error. 我创建了一个页面,当我们打开该页面时似乎是正常页面,但是在chrome和mozilla中它给出了错误。

      Failed to load resource: the server responded with a status of 500 (Internal Server Error) 

http://imgur.com/a/macb7 http://imgur.com/a/macb7
page is http://xxxxxx.com/mobile-under-10000 页面是http://xxxxxx.com/mobile-under-10000

and i have found that if i change the name of link to http://xxxxxxx.com/mobile and add class it gives no error.i cant add php class in mobile-under-10000 as class will not allow - but i really need that name as its seo friendly. 并且我发现如果我将链接的名称更改为http://xxxxxxx.com/mobile并添加类,则不会出错。我无法在mobile-under-10000中添加php类,因为该类不允许-但我确实需要该名称作为其seo友好。 if i create pages like this it works but i have to choose only one word in classname. 如果我创建这样的页面,它可以工作,但是我只能在类名中选择一个单词。 i have thousands of links which is working fine but giving 500 error. 我有成千上万的链接,可以正常工作,但给500错误。

<?php
class samplelink {
    function index() {
echo 'write something';
    }
}
?>

any idea to resolve will be great. 任何解决的想法都会很棒。 i have one option to force apache to stop throwing 500 error.but it is advisable ? 我有一个选项可以强制Apache停止抛出500 error.But明智的选择? i am using nginx with apache. 我正在用Nginx和Apache。

please advise 请指教

my .htaccess code is 我的.htaccess代码是

RewriteEngine on
RewriteCond ${LeechProtect:/home/xxxxxx/public_html:%{REMOTE_USER}:%{REMOTE_ADDR}:10} leech
RewriteRule .* http://xxxxxx.com
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([0-9a-z_/\-]+)/$ index.php\?p=$1 [QSA]
RewriteRule ^([0-9a-z_/\-]+)$ index.php\?p=$1 [QSA]
</IfModule>


RewriteRule ^.* - [F,L]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.xxxxx\.com$ [NC]
RewriteRule ^.*$ http://xxxxxx.com%{REQUEST_URI} [R=301,L]

If your Apache, and PHP / MySQL error logs are empty then there's a very strong likelyhood the issue is caused by .htaccess / httpd.conf so check these files for inconsistencies. 如果您的Apache PHP / MySQL错误日志为空,则很有可能是由于.htaccess / httpd.conf引起的问题,因此请检查这些文件是否存在不一致之处。

and i have found that if i change the name of link to http://way2enjoy.com/mobile and add class it gives no error 并且我发现,如果我将链接的名称更改为http://way2enjoy.com/mobile并添加类,则不会出现错误

This strongly indicates that you have not properly escaped characters in your .htaccess . 这强烈表明您.htaccess没有正确转义字符。

EDIT 编辑

These lines: 这些行:

 RewriteRule ^([0-9a-z_/\\-]+)/$ index.php\\?p=$1 [QSA] RewriteRule ^([0-9a-z_/\\-]+)$ index.php\\?p=$1 [QSA] 

Can be rewritten and fully escaped as : 可以重写为:

RewriteRule ^([0-9a-z_\/\-]+)/?$ index.php\?p=$1 [QSA]

There are some curious behaviours that are in your htaccess but nothing jumps out at me as potential fatal issues. 您的htaccess有一些奇怪的行为,但是没有任何潜在的致命问题htaccess我。

Some points: 一些要点:

  • You state reWriteEngine On three times in your htaccess, this may cause an error and so you can remove two times. 您在htaccess reWriteEngine On 3次,这可能会导致错误,因此可以删除两次。

I have re-organise your code so : 我已经重新组织了您的代码,因此:

 <IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteRule ^([0-9a-z_\/\-]+)/?$ index.php\?p=$1 [QSA]

 RewriteCond ${LeechProtect:/home/xxxxxx/public_html:%{REMOTE_USER}:%{REMOTE_ADDR}:10} leech
 RewriteRule .* http://xxxxxx.com

 RewriteCond %{HTTP_HOST} ^www\.xxxxx\.com$ [NC]
 RewriteRule ^.*$ http://xxxxxx.com%{REQUEST_URI} [R=301,L]
 </IfModule>

 RewriteRule ^.* - [F,L]

The final line returns a Forbidden header result (403) if it is ever reached, which seems to be quite heavy handed and possibly unnessecary response. 如果达到,最后一行将返回一个Forbidden标头结果(403),这似乎是很费力的响应,可能是不必要的响应。

I also question the leechProtect statement but don't know enough about it to advise further. 我也质疑leechProtect声明,但对它的了解不足以进一步提供建议。 But use the code above and then check your site commenting out ( #comment ) each line and then clearing your browser cache (each time, as browsers cache htaccess rules) and see if commenting out some of these requests causes the site not to return 500 errors. 但是,请使用上面的代码,然后检查您的网站每行的注释( #comment ),然后清除浏览器缓存(每次,因为浏览器缓存htaccess规则),并查看注释其中的某些请求是否导致网站不返回500错误。

Good luck. 祝好运。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM