Strange 500 internal server error with certain file

Perhaps you can help me? I have an unusual issue with a particular file.

I'm using Smarty the PHP templating engine and up until now was doing pretty well with it. When I view my website now though I keep getting a "HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request."

What's weird is the minute I rename my template from index.tpl to header.tpl or anything else like ijustmadethisup.tpl I don't get the 500 error. I think somewhere along the line the code was invalid and caused the 500 error to occur but now it won't work at all unless I rename the template.

I suspect it is a caching issue but the template_c and cache folder that I use for my Smarty app are empty and I have turned caching off using…

$smarty->caching = Smarty::CACHING_OFF;


I'm fairly new to running my own server and I am not sure how to diagnose this issue. I've looked inside /var/log/messages and /var/log/apache2/access.log and /var/log/apache2/error.log but can see no obvious problems. I'm using Ubuntu 10.10.

Any help would be appreciated.

Thanks everyone.

4 Replies

Check Apache's error log, what does it say about the 500 error?

Where do I find Apache's error log? I thought it would be here /var/log/apache2/error.log but I couldn't find anything related to a 500 error.

It's possible that PHP is not configured to send errors to Apache.

Open /etc/php5/apache2/php.ini, scroll down a few hundred lines, and find a line that says "logerrors". Make sure that it's "On" (without the quotes). Also make sure that "errorreporting" is either "EALL" or "EALL | E_STRICT" (without the quotes). This ensures that no error goes unnoticed.

Restart Apache.

Errors will start appearing in /var/log/apache2/error.log or wherever you told your virtual host to point error logs at.

hybinet - Thanks so much for this tip it's proved really useful and helped me find out where the problem was coming from.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct