views:

276

answers:

4

Hi,everyone,

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?

A: 

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.

chaos
ther error_log file doesn't conaint any error message about the error.
Charlie Epps
That's very unusual. I'd recommend making sure you're looking at the right file; virtual hosts can have their own error logs and such.
chaos
+1  A: 

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.

Stefano Borini
The page is smarty's tpl file, and it display nothing. The error message "500 Internal Server Error" is catched by firebug tool.
Charlie Epps
firebug catches whatever your server generates. That 500 is returned by your server. Check if you have errors in your template file, or the php/smarty substitution process.
Stefano Borini
A: 

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

AdamDecaf
+1  A: 

Hi,

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.

Best regards.

jhcaiced