Fixing the “unexpected T_ENDWHILE” error in WordPress + xampp

I have recently been through a lot of pain trying to configure a local installation of WordPress using xampp. The problem was that after activating a theme (not the default one) I was getting an error:

Parse error: syntax error, unexpected T_ENDWHILE in (...........)

This was driving me crazy but after a lot of searching I FINALLY found the solution! I'm so happy that I want to share it with the world because I really only found this valuable piece of information in one page (and I did a lot of searching, believe me).

When installing a local copy for use in a development environment one of the main problems to tackle is making sure that your local server is as close as possible to your production environment. There are many variables that can change like software versions and configuration parameters. For this specific case it's one simple parameter in the php.ini file that was causing issues.

Some php developers like to use short open tags, and even though I do agree that it can save some time and make the code a bit cleaner, there's a lot of discussion around it.

Long story short, apparently the php.ini file included in xampp has the option:

short_open_tag = Off

by default. By simply changing this to:

short_open_tag = On

all my problems were magically resolved!

I hope you find this useful.

8 comments to Fixing the “unexpected T_ENDWHILE” error in WordPress + xampp

Leave a Reply

  

  

  

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>