简体   繁体   English

服务器上的HTTP 500错误?

[英]HTTP 500 error at the server?

I can run this PHP script well in my local computer, but when I've tried to run PHP script in the server, 我可以在本地计算机上很好地运行此PHP脚本,但是当我尝试在服务器上运行PHP脚本时,

I got his message at the browser. 我在浏览器中收到了他的消息。 This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying. 此错误(HTTP 500内部服务器错误)表示您正在访问的网站存在服务器问题,导致该网页无法显示。

Do you have an ideas to solve it ? 您有解决的想法吗? I'm running locally in Apache and the server is IIS 我在Apache本地运行,服务器是IIS

Thanks 谢谢

in httpd.conf or httpd-xampp.conf and check if this is accidentally commented out. 在httpd.conf或httpd-xampp.conf中检查是否意外将其注释掉。

AddType application/x-httpd-php .php .php3 .php4 .php5

Try editing this part in your httpd.conf and set AllowOverride All

And also check .htaccess file, hidden .htaccess file in the htdocs folder caused the issue

It is possible that you have hosted your files in a sub directory on your server, if that is the case open up .htaccess file and add the following line 如果是这种情况,则可能将文件托管在服务器的子目录中,请打开.htaccess文件并添加以下行

 RewriteEngine On
 RewriteBase /The_Directory_Where_You_Uploaded_The_Files/

hope this solves the problem 希望这能解决问题

"HTTP 500" is a very, very generic error. “ HTTP 500”是一个非常非常普通的错误。 it can mean any number of different things. 它可以表示许多不同的事物。

Q: Have you checked the server logs? 问:您检查服务器日志了吗? What do they say? 他们说什么?

That's absolutely the first place to start. 那绝对是第一个开始的地方。

ADDENDUM 1.11.2012: 附录1.11.2012:

Hi - 嗨-

It sounds like: 这听起来像:

1) you have PHP installed on the remote, IIS server, and it's working. 1)您在远程IIS服务器上安装了PHP,并且可以正常工作。 Good :) 好:)

2) your scripts are also deployed on the remote IIS server, and they run (also good) 2)您的脚本也部署在远程IIS服务器上,并且可以运行(也很好)

3) So you need to "debug". 3)因此,您需要“调试”。

SUGGESTIONS: 建议:

1) Please contact the administrator of the remote IIS server to see if there's ANY way for you to look at the logs. 1)请与远程IIS服务器的管理员联系,以查看是否可以通过任何方式查看日志。 It's extremely likely the logs can lead you directly to the problem. 日志极有可能直接导致您遇到问题。 It's also important to be able to monitor the logs after your application is in use. 在使用应用程序后能够监视日志也很重要。 Please see if the administrator can help you. 请查看管理员是否可以为您提供帮助。

2) Failing that, you can always put in "printf" debug statements. 2)失败的话,您总是可以放入“ printf”调试语句。

"echo" is useful. “回声”很有用。

Here's a little script that writes to your own log file: 这是一个写入您自己的日志文件的小脚本:

<?php
  function PHPDBG ($s)
  {
    // change "/tmp/PHPDBG.txt" to suit your system
    $fp = fopen ("/tmp/PHPDBG.txt", "a");
    $s = date("d/m/y : H:i:s", time()) . ":" . $s . "\n";
    fputs($fp, $s);
    fclose($fp);
  }
 ?>

3) Check the following: 3)检查以下内容:

a) Make sure your first script reads all variables correctly; a)确保您的第一个脚本正确读取了所有变量; make sure the values are all the values you expect 确保值是您期望的所有值

b) Make sure it's following the same code path you expect b)确保它遵循您期望的相同代码路径

c) Make sure the URL of the second script is correct c)确保第二个脚本的URL正确

d) Try invoking that URL manually, from your browser, to insure it's correct d)尝试从您的浏览器手动调用该URL,以确保它是正确的

e) Make sure any session variables are written correctly; e)确保正确写入任何会话变量; make sure the values are the values you expect 确保值是您期望的值

'Hope that helps .. 希望有帮助..

I don't think that IIS supports PHP out of the box. 我认为IIS并非开箱即用地支持PHP。 You'll need to enable it. 您需要启用它。 Here's a great guide: 这是一个很好的指南:

http://www.simongibson.com/intranet/php2003/ http://www.simongibson.com/intranet/php2003/

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

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