简体   繁体   中英

500 Internal Server Error?

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?

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.

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.

检查以确保任何.htaccess文件都正确(语法方面)。

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.

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

/var/log/apache2

in ubuntu 16.04

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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