Now let’s get the PHP executable there.
We want to download the correct PHP 5.5 onto our Windows Azure Web Site, From PHP’s download page, we will need the VC11 x86 Non Thread Safe zip file zip file URL. Next, we can use curl to download it into our web site’s file system. But where?
Windows Azure Web Sites has an interesting file system. Some folders are local to the host your site is running on, others are located on a central file system shared by all instances of the current web site. Remember: everything that’s under the VirtualDirectory0 folder is synchronized with other machines your web site runs on. So let’s create a bin folder there in which we’ll download PHP.
curl -O http://windows.php.net/downloads/releases/php-5.5.0-nts-Win32-VC11-x86.zip
This will download the PHP ZIP to the file system.
We also will need to unzip our PHP 5.5 installation. Luckily, the WAWS shell has a tool called unzip which we can invoke:
unzip php-5.5.0-nts-Win32-VC11-x86.zip -d php-5.5.0
If needed, we can change directories and run PHP from the shell. Do remember that when PHP requires input (which will be the case if no parameters are passed in), the shell will block.
The next thing we have to do is enable this version of PHP in our web site. This must be done through the management portal. From the CONFIGURE tab, we can add a handler mapping. A handler mapping is a method of instructing IIS, the web server, to run a given executable when a request for a specific file extension comes in. Let;’s map *.php to our PHP executable. We can use the VirtualDirector0 path we had before, or use its shorter form: D:\home. Our PHP installation lives in D:\home\bin\php-5.5.0\php-cgi.exe.
Once saved, our web site should now be running PHP 5.5:
This is an imported post. It was imported from my old blog using an automated tool and may contain formatting errors and/or broken images.