Partager via


PHP on Windows Server 2008 – My New Photo Gallery

Well, it was one of these days. In order to make photos available to our family we used SharePoint since quite a while. It did a fairly decent job but I wanted more fancy stuff. So I started to look for something in Silverlight as Silverlight is our web platform. I really found something on Codeplex which did about 80% of what I wanted. But you know how engineers work: it was only 80%.

So, I took VisualStudio and started to trace and understand the code in order to adapt it and feed back to Codeplex. Well, it was an interesting experience but I had to decide that it was not worth the effort…

Back to square 1. I therefore opened the scope and was just looking for a gallery, which I could use. I found one, called Gallery2. Looking into it, I realized that it was written in PHP, which was actually a great thing for me as I read a lot of articles about Windows Server 2008 and PHP and that it shall work excellent – worth a try.

So, let’s start. As my website on www.halbheer.info is running on SharePoint I did not want to install PHP on it as I had no clue what kind of side-effects I would be generating. So I installed a fresh server with Windows Server 2008, packed IIS on top and installed SQL Server as (obviously) Gallery2 needs a database.

And now? How do I get PHP running on Windows Server 2008? There is a very good description of it on www.iis.net: Using FastCGI to Host PHP Applications on IIS 7.0. Petty straightforward and it works. However, if you use the setup as described, Gallery2 will not work. It took my a while (and several roll-backs to Snapshots – long live Hyper-V) until I found out that one of the proposed php.ini changes breaks Gallery2. So, if you want to install it, simply renamed the recommended php.ini file, restart IIS and go with it.

So, after having PHP up and running, I simply installed Gallery2. Well, it was not too complicated as I could follow another site on iis.net: Gallery2 on IIS. And this time you may follow all the proposed changes in php.ini :-). From there on, it is a question of installing the modules and themes, doing some CSS editing and you are done!

I did it twice. I installed all the modules, played with them (some of them did not work, some of them were not satisfying at all), then rolled back (did I already say that I love the Snapshot functionality in Hyper-V?) and re-installed Gallery2 with the modules I needed. Then did some cosmetics (took main.php as default, did some HTTP-redirection) and went live!

So, this is definitely something I can recommend and PHP on IIS with SQL Server is really easy to get going!

Oh, by the way. Here is the gallery on https://gallery.halbheer.ch or https://gallery.halbheer.info:

500x234[1] Have a lot of fun and comments are more than welcome

Roger