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.
Big thanks !!!
This post have 8 years and today solve me a headache for me.
Thanks a lot for sharing!
Big thanks !!!
config php.ini -> short_open_tag = Off ( fix On )
Awesome – thank you!!
Didn’t fix the issue…still searching through syntax to try and figure out what the problem is.
Oh my, thank you so much for this! I just spent the last 2 hours trying to fix that…
Thank you. My hosting company upgrade the PHP on server, after my site went mental. You provided the cause and solution. Cheers
Hah, exactly today I was playing around with one theme and was wondering why it drops that error. I re-installed WP, tried lower version and so on, but nothing helped. When I searched the error on google, your web site was the 3-rd result. Thanks for helping the community, mate!