This is one of a series of blog posts about my experience competing in the European WinPHP Challenge 2009. Sponsored by iBuildings, Microsoft and Leaseweb, competitors are asked to build a PHP app for Windows Server 2008 and IIS 7 to showcase the FAST in FastCGI. The winner gets travel and tickets to Microsoft MIX 2010 in Las Vagas in March. My entry is “Give It A REST”, a SOAP <-> REST gateway.

In an earlier post, I described my experience in building a (hopefully) suitable PHP development environment on Windows Server 2008. Since then, a couple of folks have kindy sent some feedback to help improve my understanding a couple of the sticking points I mentioned.

In the Zend Forums, this post describes how to get xdebug up and running under Zend Server on Windows (via Bram). Sadly, Zend’s build of PHP still crashes after following these instructions. Commenting out the Zend Extension Manager seems to stop these crashes, but I’m not sure that’s a compromise I’m willing to make. As I mentioned before, whilst I’d normally choose to install xdebug into any environment I’m working on, it’s not a big deal for me on this project because I am interested in seeing what Zend’s environment has to offer on Windows.

Elizabeth N. Smith from the PHP Windows teams kindly pointed out that the downloads page on www.php.net does indeed offer a NTS (non-thread-safe) build of PHP for Windows further down the page. I’m planning on plundering the PDO driver for MS SQL from there and evaluating it as part of my R&D phase.

Sadly, though, I’ve not seen anything said about why there isn’t a binary standard for PHP on Windows 🙁 These binary incompatibilities just seem to re-enforce why proprietary products on proprietary platforms should be avoided.

Be the first to leave a comment »

I’m currently looking for two PHP developers to come and join my web development team at Gradwell. The team creates and maintains the web-based control panels for our award-winning VoIP service, plus our broadband, email, and web hosting services. From time to time we also get to do crazy things like Twittex and Facebook applications. Our partners often describe us as the geekiest company they ever have to deal with. And one nice bonus is that we use Linux for our desktops not Windows 🙂

The full details are on the Gradwell website, but the basics are that I’m looking for people with a computer science / software engineering degree, with PHP experience (via open-source projects is fine; it doesn’t have to be commercial experience), and experience with symfony is a major plus. It’s essential that you fit in with everyone else in the company, so you’ll need to be someone who’s proactive but supportive rather than competitive.

If you’re interested in applying, talk to me on Twitter or send through a CV and covering letter explaining why you’re the person for the role to stuart(dot)herbert at gradwell(dot)com.

Be the first to leave a comment »

This is one of a series of blog posts about my experience competing in the European WinPHP Challenge 2009. Sponsored by iBuildings, Microsoft and Leaseweb, competitors are asked to build a PHP app for Windows Server 2008 and IIS 7 to showcase the FAST in FastCGI. The winner gets travel and tickets to Microsoft MIX 2010 in Las Vagas in March. My entry is “Give It A REST”, a SOAP <-> REST gateway.

In my last post, I solved my problems with PHP not working out of the box, and finished choosing and installing apps to complete my development environment. With that done, it’s time to think about the design of Give It A REST.

Product Brief

I find it always helps to start with a short description of what I’m trying to achieve. In a larger enterprise environment, this would normally be found in the product brief written by the product manager.

Given a (possibly remote) WSDL file, Give It A REST will automatically generate a RESTful webservice bridge between remote PHP clients and the remote SOAP service described by the WSDL file. Give It A REST will run on Windows Server 2008, it will use .NET to connect to the remote SOAP service, and the RESTful webservice bridge will be written in PHP.

Throughout the project, I’ll keep coming back to this description to make sure that this is still what I am delivering.

Use Cases

The product brief is just an idea; it needs further iterative development before it’s mature enough to turn into code. Sketching out some basic use cases to identify who will use Give It A REST, and how they will use it, is a good next step. Use cases can be very lightweight (especially the ones I typically create), but they’re easy to share with non-technical folks, and they make it fairly easy to play “what-if” and “walkthrough” type games with your customers. And because they are quick to create, they save you time overall.

When I’m creating use cases, they inevitably go through several iterations. I generally start with some rough ideas for actors, explore the high-level systems that the actors interact with, and then revamp my list of actors to suit the systems and use cases that I’ve discovered. Then, with my new list of actors, I do the whole exercise again, and I keep repeating it until I feel happy with the results. It’s that emotional connection that I’m always searching for whenever I’m designing something; I’m a great believer that this is where the creativity ultimately lies.

In this case, I have decided on four high-level systems that together will make up Give It A REST:

  • I need some sort of user manager to handle user registration, login / logout, and administration of registered users.
  • A bridge manager will handle the tricky work of creating, managing and destroying individual SOAP <-> REST bridges. It will also handle administration of who is allowed to use which bridge.
  • The bridge itself will handle SOAP <-> REST requests and responses, and also provide tools for investigating problems, usage stats, and also (if possible) documentation auto-generated from the WSDL file.
  • Finally, users need a way to find the available bridges, so I need a bridge browser for that. It will also provide the mechanism for users to request permission to use a bridge.

The generic ‘users’ need to be clarified into specific actors who participate in specific use cases. Working out the specific roles that a user can have makes it a lot easier to get the permissions system right first time. The downside is that mistakes made at this stage are the most expensive of all to fix.

  • Admin users are the administrators of Give It A REST. They can do everything the app allows, without restriction.
  • Bridge owners are users who own one or more bridges. They have control over who can and can’t use their bridges. Any user can create a bridge, and so become a bridge owner, but bridges have to be approved by an admin user.
  • Bridge users are registered users who are not admin users or bridge owners. They have successfully applied for permission to use one or more bridges.
  • Registered users are users who have registered to use the app, but who do not yet have permission to use any of the bridges.
  • Finally(!) we have guest users, who need to register to use the site. Their registration must be approved by an admin user before they become registered users.

The actors describe roles, not people. People’s roles can and do change as they successfully complete some of the use cases.

Here are the use case diagrams. You should be able to click on each thumbnail to open the full diagram.

Use Cases: Admin Users

Use Cases: Admin Users

Use Cases: Bridge Owners

Use Cases: Bridge Owners

Use Cases: Bridge Users

Use Cases: Bridge Users

Use Cases: Registered Users

Use Cases: Registered Users

Use Cases: Guest Users

Use Cases: Guest Users

Strictly speaking, the remote PHP RESTful client is also an actor with use cases that could be identified and captured, but I’ve chosen to treat the PHP client as just another way that my existing actors can interact with Give It A REST.

Problems To Solve In R&D

Thankfully, the majority of the use cases are run-of-the-mill web-app functionality that are straightforward to code up. But together, the product brief and use cases have generated a number of problems that I need to solve by a little bit of R&D.

  • Given a WSDL file, how can I create a SOAP client in .NET?
  • How do I call that SOAP client from PHP code?
  • How do I capture the raw XML sent from the .NET client to the SOAP service, and how do I capture the raw XML sent back in response?
  • From PHP, can I make multiple simultaneous calls through the SOAP client to the SOAP service?
  • Because we’re using FastCGI, can I call multiple .NET SOAP clients from a single PHP process w/out memory leaks?
  • How do I automatically define a RESTful client for a SOAP service?
  • How will the security for calling a bridge from a RESTful client work?
  • How do I automatically generate documentation from the WSDL file?
  • What do I use for queueing up offline tasks on Windows?
  • How do you do test-driven coding with .NET?

It may feel like I’ve taken the long way round to reach this list, but thanks to having use cases, I’m confident that I have the right list of questions to solve during R&D. If (and right now it is an if) I can solve them all, Give It A REST should be doable.

Whether I have enough time to do it, now that is another question 🙂

Next Steps

In this post, I’ve clearly stated my initial idea by writing a very basic product brief, and then I’ve started on the long road to clarifying my thinking by creating the main use cases for Give It A REST. I don’t know whether it’s possible to achieve all of these use cases, as I’m not a .NET developer, so I’ve identified the main questions that need to be answered by a little bit of R&D.

The next step is to try and answer all of these questions 🙂

Be the first to leave a comment »

This is one of a series of blog posts about my experience competing in the European WinPHP Challenge 2009. Sponsored by iBuildings, Microsoft and Leaseweb, competitors are asked to build a PHP app for Windows Server 2008 and IIS 7 to showcase the FAST in FastCGI. The winner gets travel and tickets to Microsoft MIX 2010 in Las Vagas in March. My entry is “Give It A REST”, a SOAP <-> REST gateway.

In my last post, I’d reached the point where I had a phpinfo() page in the right place, but had run into a problem with PHP for Windows crashing. In this post, I investigate and solve the crashing problem with PHP for Windows, and then get the rest of the tools in place to complete my development environment for this project.

Getting PHP For Windows Working

Today’s job is to figure out why the PHP for Windows installer has installed a non-working copy of PHP, and whether anything can be done about it, or whether I need to switch to using someone else’s PHP build.

I know from many years of experience that IIS and Event logs on Windows are next to useless when diagnosing problems with PHP on Windows. If you’re used to Apache’s (mostly) helpful errors log, it can be a bit frustrating the first few times. Eventually the bruises from banging your head against a brick wall convince you to find a better approach 🙂

So instead, I always prefer to fire up a Command Prompt and see whether or not PHP is actually working when run from the command line. This quickly shows a possible cause of the problem:

C:Program FilesPHP>php-cgi.exe
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:Program FilesPHPextphp_mssql.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:Program FilesPHPextphp_pdo_mssql.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:Program FilesPHPextphp_pdo_sqlite_external.dll' - The specified module could not be found.
 in Unknown on line 0

This is caused by a missing DLL – ntwdblib.dll – which the MSSQL extension needs to use in order to talk to Microsoft SQL Server. It looks like the PHP for Windows installer doesn’t distribute this required dependency, and neither does it check to make sure the dependency is satisfied before allowing you to install PHP.

The best way to get hold of ntwdblib.dll is to copy it from wherever you have installed SQL Server. That way, you can be sure that the DLL is compatible with your copy of SQL Server. Back in the SQL Server 2000 days, you could also get it by installing the SQL Server Client Tools onto your web server (always a good idea; very handy being able to fire up SQL Server Management client to diagnose database connection issues when working in firewalled DMZ environments).

(If memory serves – it’s been 18 months since I did this for a living – the need for ntwdblib.dll will finally go away when PHP has a modern extension that uses the SQLDMO or later API. The MSSQL extension uses TDS to talk to SQL Server currently. Unfortunately, TDS was designed for Sybase and lacks support for useful features in SQL Server 2000 and beyond like unicode. Of course, there’s a downside; switching from TDS will make it almost impossible to use Linux webservers against an SQL Server back-office setup).

The quick fix is to edit php.ini and disable those extensions for now. With that done, http://localhost/phpinfo.php now works. Woohoo! Test case satisfied 🙂

Improving On PHP Performance

One of the best ways to boost the performance of your PHP scripts for free is to download and use Zend Optimizer. If you haven’t heard of it before, Zend Optimizer analyses your PHP code when it is loaded into the PHP scripting engine, and rewrites the bytecode to be more efficient. Zend have made it available as a free download for several years, but now it’s also available as part of the larger Zend Server bundle, where it is known as Zend Optimizer+.

Zend Server’s copy of PHP also comes with APC (the bytecode cache that will be bundled by default with a future version of PHP; I’ve lost track of whether that will be PHP 5.3 or PHP 6), which also boosts the performance of your code. This is something you have to download separately if you use the PHP installer from www.php.net. And it’s also worth looking at Zend Server for its simple web-based control panel to manage your PHP configuration, and (if you buy a license for the product) for its ability to monitor your PHP scripts to see what needs your attention.

I was very pleased with how easy it was to install and configure Zend Server. Like the community PHP installer, it doesn’t seem to support anything other than the default web site, which is a serious oversight for use in larger organisations, but otherwise its ease of use is exactly what your average Windows PHP dev would appreciate.

Interestingly, when it comes to databases, Zend Server doesn’t include the PDO extension for SQL Server. I had a very quick go at taking PHP.net’s build of pdo_mssql and installing it into Zend Server’s build of PHP, but unfortunately Zend Server reported that the extension failed to load. The problem is that PHP.net’s release of PHP (and extensions) is built with thread-safety on, but Zend Server’s release of PHP is built with thread-safety off. It’s not for me to say which one is right, but it does mean that the two different releases appear to be binary incompatible.

And that is something that can’t be good for the PHP community on Windows overall.

(PS: make sure you un-install the community version of PHP for Windows before installing Zend Server. If you use Command Prompt to run Zend Server’s php.exe, it goes and loads the php.ini file from the community version of PHP first, which created some interesting problems whilst preparing this article. Basically, if you manage to screw up PHP so it can’t run, the Zend Server control panel stops working precisely because it is written in PHP. A bit of an egg/chicken situation there).

Choosing A Database Server

Most web-based applications today use a RDBMS to store and retrieve their data. Microsoft have made a baby version of their heavyweight SQL Server product available for developers to work with.

Microsoft has made it easy to get SQL Server Express through their Web Platform Installer. They currently have a beta 2.0 release out that also includes bundled PHP. However, I can’t recommend this approach at the moment because of the licensing terms, which state that this is pre-release software that you’re not allowed to use in a “live operating environment”, and that your rights to use the software expire at the end of June 2009 or whenever a commercial version of the platform installer is released – whichever happens first. I don’t have a problem with closed-source software, but I do object to software with expiry dates. (I accept that I’m in a minority on this).

SQL Server “Express” is a fat lady … 218 MB in size. Definitely not something I can download over mobile broadband whilst traveling to and from the office! By contrast, MySQL RPMs for RedHat Enterprise Linux 5 weighs in at a positively svelte 28.2 MB – almost a tenth of the size. And it comes with more features. But, as I’m actually quite a fan of SQL Server, I’m going to add it to my dev environment.

The list of download options might be too cryptic for some developers:

Download Options For SQL Server Express

For 32-bit systems, download the _x86_ file. For 64-bit systems, download the _x64_ file. Perhaps Microsoft might want to put suitable descriptions on this list, for folks who aren’t sure which file is right for them?

Oh, and don’t forget to download the dependencies listed earlier up the page; they’re not present on a fully-updated Windows Server 2008 install. I swear, it’s just as bad as using a RedHat box 😉

Choosing A Version Control System

If you don’t use one already, you should. Version control systems are an essential part of any development environment, even for one-man hobby projects such as this one 🙂

My VCS of choice is git. Subversion runs well on Windows, and has for years, but I’m very mobile and absolutely need the ability to make commits whether or not I have internet access at the time. (Walk in my shoes for a week, and you’ll find the idea that we’re now “always connected” somewhat laughable). I don’t make anywhere near full use of git’s many excellent features; like many folks I’m waiting for the books on git to appear later this year.

There’s a port of git for Windows from the msysgit project on Google Code. I haven’t used it before, so it’ll be interesting to discover how well it works.

Choosing A PHP IDE

I’ve used phpEclipse on Windows for PHP development for several years, but the guys at worked convinced me to switch to using the Netbeans nightly builds instead. The demise of Sun earlier this week has cast a shadow over whether or not Netbeans has a future (Oracle in the past has not been a supporter of Netbeans), but until someone pulls the plug, it’s my IDE of choice. As with git, I’ve never used it on Windows, so it’ll be interesting to see how well it works.

Using Netbeans also means downloading Java – which you need to do before you can install the PHP bundle of Netbeans. Downloading Java for Windows is a two-step process; you download a small installer first, and when you run the installer it goes off and downloads the complete Java standard edition as a second step. I’ve never understood why Sun do this; perhaps it’s their way of ensuring that you always have the latest version of Java available when you actually do the install? Answers on a postcard please 🙂

Netbeans currently only supports the excellent xdebug extension for PHP for single-step debugging. It doesn’t support Zend Server’s own zend_debugger extension. (Does anything, other than Zend Studio?) I had no luck at all getting any of the xdebug DLLs working with Zend Server; both the thread-safe and non-thread-safe versions cause Zend Server’s copy of PHP to crash. I haven’t actually tried it, but I expect that the xdebug DLL works absolutely fine with the PHP for Windows from php.net.

Hrm … it’s been a tricky decision, but for now I’ve decided to stick with Zend Server, because I want to evaluate how useful its built-in monitoring is. If the lack of xdebug becomes a problem, I can always setup a second website under IIS w/ PHP from PHP.net and just switch between the two.

Completing The Development Environment – Visual Studio

To finish my development environment, I need something for building & debugging .NET code. (Part of my application needs to be built in .NET). Again, thanks to the folks from Microsoft who attended the PHP UK Conference 2009, I have a 1 year evaluation license for Visual Studio 2008 Standard Edition. From the install screens, I’m led to believe that updates for Visual Studio are downloaded using Windows Update. But Windows Update states that there are no updates available.

I’m having a bit of trouble believing that 🙂

The Development Environment – Recap

With the development environment now up and running, I thought it would be useful to recap on what the full environment looks like.

Note that I have chosen not to spend money on anti-virus software for Windows, because the VM will be used for a one-off project and then destroyed. If Windows was your regular dev platform, you’d need to invest in anti-virus and anti-spyware software, and pay a regular subscription in order to keep it up to date.

With downloaded installers and temporary files deleted, the overall size of the Windows Server 2008 virtual machine now stands at 10.54GB according to OS X, and 11.3 GB according to Windows Server 2008. I’m left with only 4GB of free space under OS X, and will be spending the evening looking for ways to free up a bit more space!

How do I feel about the development environment? A little disappointed, if truth be told. Under Windows, I’m largely stuck with building the development environment from the pre-built components other people have made for me. That’s fine, until combining those components reveals compatibility and/or quality problems.

It’s worth pointing out how useful Twitter has been during this work. I’ve had no less than three folks from Zend responding to my tweets, including their CEO and the Zend Server product manager. I’m not a Zend customer, nor am I known to be a Zend advocate. At work, we spend more with organisations like VMWare and Netsuite than we could ever need to spend with Zend, and yet their support simply doesn’t match up to how responsive Zend has been.

Next Steps

With the development environment built, it’s time to turn my attention to the app I’m going to build. Before I write any code, I need to sketch out a design for the app, and probably do some R&D on the components that will be completely new to me. I’m unlikely to write any PHP code for some time yet.

Be the first to leave a comment »

This is one of a series of blog posts about my experience competing in the European WinPHP Challenge 2009. Sponsored by iBuildings, Microsoft and Leaseweb, competitors are asked to build a PHP app for Windows Server 2008 and IIS 7 to showcase the FAST in FastCGI. The winner gets travel and tickets to Microsoft MIX 2010 in Las Vagas in March. My entry is “Give It A REST”, a SOAP <-> REST gateway.

When it comes to software development, I’m old fashioned. I’m a firm believer that you should develop and test on the platform that you’re going to ship your code for. And that means getting Windows Server 2008 installed somewhere convenient. My primary test case for this step is to be able to publish the output of phpinfo() at http://localhost/phpinfo.php via FastCGI on IIS 7.

As it has been over 18 months since I last used Windows Server, I hope my experiences prove helpful for anyone else going through this for the first time.

  • Getting Windows Server 2008 Installed
  • Installing IIS 7
  • Downloading PHP 5.2.9 for Windows
  • Choosing A PHP Install
  • Creating The Phpinfo File
  • Testing The Phpinfo File
  • Next Steps

Getting Windows Server 2008 Installed

Convenient for me means VMWare Fusion running on my MacBook Pro. My laptop is my main machine, and I’m too mobile to make software development via Remote Desktop practical. Thankfully, I have a Windows Server 2008 license which the folks at Microsoft dropped into my hands at the recent PHP UK 2009 Conference. But what I am short of is disk space. (Last week, I replaced my MacBook Pro’s hard drive with one of those very nice Samsung SSD’s. Actually, “nice” doesn’t remotely do it justice, but what you get in performance you lose in capacity 🙁 )

It took three attempts to get Windows Server 2008 up and running under VMWare Fusion. First attempt failed because the internal DVD drive couldn’t read the install media. I suspect the DVD drive is faulty, although the install media is somewhat scratched fresh out of the packaging. Second attempt failed because VMWare Fusion crashed. I’ve never seen Fusion crash before, so that was entertaining. Third time lucky, up and running …

… and waiting for the inevitable critical updates to download and install. And then the next batch. It’s an unavoidable process, no matter which OS you choose, to be fair, but it would be less wearying if Microsoft batched up the fixes into service packs much more frequently, in order to save time and reboots. (This blog post is particularly verbose because I have plenty of time waiting for things like Windows updates and other downloads. Future posts will be much shorter!)

So, a minimal installation of Windows Server 2008 has taken up 9.44 GB of space so far, leaving me with just 6 GB of space left on my computer. With IIS 7, Visual Studio and SQL Server still to be installed, plus a PHP IDE, I can see that this is going to be a problem. (By contrast, my Ubuntu desktop install, all in, weighs in at only 7.7 GB of used disk space). I might just have to archive my CentOS server test VM for the duration.

Installing IIS 7

Next step – get IIS 7 installed. Hrm … it doesn’t appear on the list of features that Server Manager knows about. But it doesn’t appear to be installed yet either. Where the frack is it? Answer: Windows Server 2008 uses the concept of roles. Pop into the roles section of Server Manager, and you’ll find IIS 7 there. Click through to the ‘Next’ page to go through the Web Server options in detail, and … where is FastCGI? There’s no mention of it at all.

It seems to be bundled with the CGI option. Perhaps a future update from Microsoft could update the description to mention that? Folks used to a Linux platform are also used to having different web server modules for CGI and FastCGI features.

Downloading PHP 5.2.9 For Windows

Before we can configure IIS 7 / FastCGI, we need a copy of PHP for Windows. I thought that it might save time to simply download Zend Server CE for Windows and see how that went. Unfortunately, when I checked this evening, the Zend Server downloads page didn’t list any downloadable packages for Windows, so that wasn’t an option. (Update: the downloads work now. Many thanks Zend).

Not a problem, thinks I … I’ll just download the pre-built PHP for Windows binaries from www.php.net.

Until now, I’ve resisted talking about how annoying the infamous User Account Control (UAC) feature of Windows Vista / Server 2008 is. I don’t want these blog posts to be a review of Windows Server. But as annoying as it quickly becomes, UAC is nowhere near as annoying as the Trusted Sites feature of IE. Especially because this feature stops you from downloading the PHP for Windows binaries from www.php.net. It doesn’t ask me whether I would like to allow the download. It just refuses to download the ZIP file that I have clicked on, presumably because www.php.net actually sends back a redirect to a local mirror.

I couldn’t quickly spot a way to disable the Trusted Sites feature of IE (the controls are disabled in IE’s Options dialog box). Not a problem, thinks I; I’ll just download Firefox and avoid using IE … Guess what? The Trusted Sites feature of IE stops you downloading Firefox too … again, presumably because the download link on Mozilla’s page sends back a redirect to another server. (Mozilla might want to do something about that; they must be missing out here).

The way around it is to go into Security Manager, and down on the right hand side of the initial page is a link to Configure IE ESC. Click on that, then you can switch Trusted Sites off for administrators or all other users. It would have been much better if the UI for IE told me about this, or even offered me a click through to the feature.

I can understand where Microsoft are coming from: best practice for avoiding infections of malware and viruses from the ‘net is to avoid using IE on your servers at all. It’s a consequence of putting a desktop environment on a server (you’d never find a good Linux sysadmin putting a desktop environment onto a Linux server), and a legacy of that environment being Windows. But, for a development environment, it’s reasonable to switch this feature off, so I did.

And then promptly downloaded Firefox 🙂 Apart from seeking an escape from the annoyances of IE, there are two very good reasons for ditching IE for Firefox. Firebug, and FirePHP. I intend to use both as part of this competition.

With Firefox installed, I re-enabled IE ESC, and then promptly forgot about it and IE. Forever. When will Microsoft learn that a good UI can make someone an advocate, and a bad UI (like the one around IE ESC) can make someone a detractor?

Choosing A PHP To Install

php.net provides two different bundles of PHP for Windows for download. You can download a ZIP file, and install the binaries yourself, or you can download a nice Windows installer, and let it do all the work for you. When I used to do this sort of thing on a regular basis, I used to build PHP on Windows from source, so I thought it would be interesting to look at the Windows installer first.

And it’s quite nice, I have to say. It provides the option to configure IIS with FastCGI for you (which sounds like it’ll save a lot of hassle … will that be famous last words? 🙂 ). On the down side, it doesn’t support installing multiple copies at once (how are you supposed to test your code against new releases of PHP if you can’t install multiple copies on the same dev box?), and by default it has every PHP extension marked to not be installed (which might trip up quite a few folks).

It also doesn’t ask you which website(s) you want configured to use PHP/FastCGI. This is a common problem with anything on Windows that tries to automate configuration of IIS. This doesn’t matter for development, where you’ll just publish the one website (an IIS website is roughly equivalent to an Apache virtual host), but on production servers publishing multiple websites, this quickly becomes a problem. It would be nice to see Microsoft sponsor someone to create a first-rate installer for PHP for Windows.

Creating The Phpinfo File

With IIS automatically configured by the PHP for Windows installer, all we should need to do to satisfy my test case is to use Notepad to create a suitable PHP script and drop it into the right place, right? After all, I’m deliberately using a user with Administrator privileges because this is a dev box and I don’t want to waste time working around security that this dev box just doesn’t need.

Sigh. Think again.

Notepad tells me that I don’t have permission to save into the wwroot folder (c:inetpubwwwroot, if you’re not sure where it is). Hrm. What’s behind this hold up? Do members of the Administrators group have permission to create files in this folder? Yes. Am I a member of the Administrators group? (You’ll find that in Server Manager, under Configuration -> Local Users and Groups). Yes. Can I save files to the wwwroot folder? No.

Sigh.

In the end, I worked around this by explicitly giving my user full control over the wwwroot folder. I’m not happy about having to do this, but I’ve already lost enough time to dealing with Windows security features tonight.

Testing the Phpinfo File

Although I don’t have a complete PHP dev environment yet, I should now have enough to be able to see the phpinfo page in Firefox, right? Point browser at http://localhost/phpinfo.php. Drum roll please!

Oh dear. 500 internal server error, and a crash dump automatically uploaded to Microsoft. PHP 5 crashed according to the event logs. Oh ffs.

Next Steps

Well, the good news is that (so far) running Windows Server 2008 in a VM isn’t particularly painful, performance wise. I’ve been able to multitask just fine whilst waiting for downloads and updates and reboots and so on. This is mostly down to the Samsung SSD, as my machine certainly doesn’t have enough RAM to do this when paging out to a traditional hard drive! It will be interesting to see how well it continues to cope with Netbeans and Visual Studio open at the same time when I actually get to write some code 🙂

The bad news is that, three and a half hours after starting the task, I don’t have PHP/FastCGI up and running on Windows Server. Close, but no cigar.

I’m going to call it a night, and take another look at this on Wednesday. Andi Gutmans from Zend has kindly tweeted me a download URL for Zend Server for Windows. That’s downloading now, and I’ll be switching over to that on Wednesday.

In the meantime, good luck to everyone else in the European WinPHP Challenge. I hope you have more success with your dev environment than I’ve had tonight.

Be the first to leave a comment »

I had word today that my entry into the European WinPHP Challenge 2009 competition had been accepted. As I haven’t seen anyone else blog about it yet, I’m starting to wonder how many participants there are 😉 (Someone should setup a Planet WinPHP Challenge site or something).

Seriously, the competition is a good idea. During my four and a bit years working on a proprietary PHP CMS for Box UK (2003-2008), about half of the customer base chose Windows Server as their server platform. Generally, folks choose to deploy web-based applications on Windows Server because they already have Windows Server. Selling them something that will only work on Linux is a tough sell, so a competition like this that seeks to show off how well PHP works on Windows should be another small step forward for all those small ISVs like Box UK who want to sell products written in PHP – provided Microsoft actually do something marketing-wise with the results.

The tag line for the competition is: “To help show how well PHP runs on Windows, we are holding the “European WinPHP Challenge” to showcase the FAST in FastCGI.” (their emphasis) So I figure an interesting showcase would be to build an app that combines PHP and .NET into a web services gateway.

And, it would actually be useful.

PHP’s SOAP client falls somewhere between being a toy and a joke, depending on how much your job depends on it working against real enterprise services. Because these services are built in .NET (or Java) for other .NET programmers to use, they exploit the full expressiveness of SOAP (well, the automated wizard that builds the service does, but you get the idea 😉 ) without any thought of toning things down to remain interoperable with PHP. It’s a source of great frustration at work.

So my competition entry is called “Give It A REST”, and the idea is to create a SOAP<->REST gateway using PHP and .NET, running under IIS7, before the end of May. My primary test case is being able to interface with the SOAP APIs published by Netsuite and Daptiv from PHP via a RESTful interface. The PHP client will be remote; it will not be running on the same box as Give It A REST. And the PHP client won’t be using SOAP at all.

Should make for an interesting six weeks or so 🙂

Be the first to leave a comment »

This Month

April 2009
M T W T F S S
« Mar   May »
 12345
6789101112
13141516171819
20212223242526
27282930