Tag Archives: IIS

Setting up PHP on IIS 7.0

Today is the last day of our previous UX developer David Belcher, since his contract is up and my company has hired a permanent UX developer. David had setup a reference site for the different projects he was involved in, but it is currently hosted on one of his consultancy company sites. The content should stay up for as long as we will need it, but as soon as we are going to need to make changes to the reference styles, or any of the mock-ups, it will be out of date, as our UX developer will not have access the site to make changes.

To help ease this transition, yesterday I offered to see if we could get it setup somewhere where it could live and be updated. The catch was that wherever were would put it up would need to be able to run PHP. I found some information on IIS 7.0 being able to host PHP, so we decided to host it locally on an internal development web-server until we can determine a permanent place where we would like it to live.

I did a Google search and found that there is a whole sub-domain for PHP on the IIS.net site. Right there at the top of the page was a link to a Microsoft Web Platform Installer for PHP. That wound up being a straight forward setup, but one of the pages was throwing an error and not having any PHP experience, other than reading a few PHP files, I wasn’t sure what was going on.

I found a couple of resources directing me to the display_errors setting in the PHP config file php.ini. As this is an internal development box, I felt comfortable enough to turn this flag to On, since to access the server one has to be on our VPN, and the security risk for a internal PHP site that is for reference of styles and workflow would be pretty low risk. So I made the change to the php.ini file and restarted IIS. When I hit the page, I was now getting:

Parse Error: syntax error, unexpected $end in [somefile].php on line [x]

Cool, I was one step closer to figuring out what was happening instead of a generic server error. Now it was time to figure out what was causing the syntax error. After a while of trying modify the file by trying to strategically remove sections, followed by searching for the generic form of my specific message, I came across this post on the site My Digitial Life. After going back in to the php.ini file and setting short_open_tag to On and restarting IIS, the page came to life.

I realized after doing all of this yesterday, that I should document this somewhere, and as we don’t have a good place to track this internally, I would post these steps so that someone else might benefit from them, instead of just being buried in a personal composition book of work related notes.

Hope this can help someone out there when they encounter a similar situation.

For those unfamiliar with PHP, to make sure that it is working, and to check the version you can create a test file that you can hit to get version and deployment info on your PHP setup. Just create a file test.php with the following in it:

<?php  phpinfo(); ?>

Then hit the page test.php and you should see something along the lines of:
test.php result sample