500 Internal Server Error?

百般思念 提交于 2019-11-27 07:01:35

问题


Recently, I put my project which is php+smarty+mysql in my httpd server. But I encountered an error that says:

500 Internal Server Error

My OS is archlinux, and the httpd server and php were installed like this:

sudo pacman -S apache php

If I use a test native php file which contains the following:

  <html>
    <head>
    <title>PHP Test Page</title>
    </head>
    <body>
    This is Arch Linux, running PHP.
    <?php
      phpinfo();
    ?>
    </body>
    </html>

it runs correctly. It tells me that the php can work well. But why is my project with smarty not working? Is there any one who has encountered this problem?


回答1:


With the info you provided it's difficult to say.

Error 500 happens because you did some error in the code that is supposed to produce the page, or the code generates some unhandled exception. My suggestion is to visit the page that gives you the 500 error, and then try to comment out all your code. See if the issue is still present. If not, uncomment the code until you find the critical part that originates the error. Could be anything, a typo, a file not found, a logical error, anything.

Also, check in the webserver logs, if you can read them.




回答2:


Look in your Apache error log (often found at /var/log/httpd/error_log, though this varies greatly). It will have more information about the server error.




回答3:


Check to make sure that any .htaccess files are correct (syntax wise).




回答4:


just happened to me and wanted to write down the solution.

The configured Smarty cache directory (/var/cache/Smarty) was configured with incorrect permissions, the apache process needs to create files in that directory.

This is the directory you set with the compile_dir directive.

BTW, the error_log file doesn't show anything with this error, Firebug shows a 500 Internal Server Error.




回答5:


I was able to get the error details by checking error.log file inside

/var/log/apache2

in ubuntu 16.04



来源:https://stackoverflow.com/questions/1210380/500-internal-server-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!