I have Windows 2008 Server with IIS, PHP, MySQL installed on it and there are several PHP websites working fine. But when I try to open one of my websites in a browser it shows the source code of page instead of executing the PHP code.

I thought that this is related to the MySQL database connection at first, but when I installed Vs.Php for Visual Studio 2010 and tried to open my website, it worked.

I think it may be related with IIS settings. By the way test.php works fine.

Any idea?


I had the same problem with some of my sites on my Debian Squeeze server after I upgraded to a newer version of PHP.

The problem was that the PHP pages that weren't loading were using the PHP short form <? ?> and I didn't have short_open_tag enabled in my php.ini file.

If the short_open_tag isn't enabled, one must use <?php instead.


  1. Enable the short_open_tag option in your php.ini file. More on that can be found HERE.
  2. Use the <?php open tag instead of <?. If using XML in conjunction with PHP, this is the best solution, as PHP short tags conflict with XML.
  • There is a setting in the php.ini file called short_open_tag that deals specifically with this. [read about it here](php.net/manual/en/ini.core.php) Jul 29 '12 at 21:13
  • woow, thanks man, it worked. I've been dealing with this for 2 days. Thanks a lot Marcus.
    – Salim
    Jul 30 '12 at 11:42
  • No problem. I should´ve written a shorter fix. The short_open_tag is by default disabled in newer versions of PHP. Since some programmers like to make it easy, they make these short open tags alot ;) Nojak filled in what I forgot to mention. Thanks againt Nojak :) Jul 30 '12 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.