0

I use a startup script to install PHP, normallay I would use the default script of the PHPAzure SDK, which installs the newest available version, but I need absolutely PHP v5.3.8.

So I wrote my own install script (which I use instead of install-php.cmd):

@ECHO ON

SET PHP_FULL_PATH=%~dp0PHP\v5.3\php-cgi.exe
SET NEW_PATH=%PATH%;%RoleRoot%\base\x86

%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%',maxInstances='12',idleTimeout='60000',activityTimeout='3600',requestTimeout='60000',instanceMaxRequests='10000',protocol='NamedPipe',flushNamedPipe='False']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%'].environmentVariables.[name='PATH',value='%NEW_PATH%']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%PHP_FULL_PATH%'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/handlers /+"[name='PHP',path='*.php',verb='GET,HEAD,POST',modules='FastCgiModule',scriptProcessor='%PHP_FULL_PATH%',resourceType='Either',requireAccess='Script']" /commit:apphost
%WINDIR%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /"[fullPath='%PHP_FULL_PATH%'].queueLength:50000"

The problem is, that I'm not very familiar with writing startup scripts.

And I now have the problem that after deploying the package the PHP handler path is completely wrong, it always points to a temporary build path somewhere on my local dev machine instead of taking the path relative to the recent approot.

Maybe you can help me with configuring this script with the correct parameters?

The correct path to my custom PHP installation is:

approot/bin/PHP/v5.3/php-cgi.exe

ownking
  • 1,956
  • 1
  • 24
  • 34

3 Answers3

0

I found the problem: I was experimenting with different PHP versions by using the IIS PHP Manager to switch them.

My version control now showed my that the Web.config was modified:

<handlers>
    <remove name="PHP" />
    <add name="PHP" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\myproject\WebRole\bin\PHP\v5.3\php-cgi.exe" resourceType="Either" requireAccess="Script" />
</handlers>

The PHP manager enhanced these lines. However it's good to know about this option.

Stephane Rolland
  • 38,876
  • 35
  • 121
  • 169
ownking
  • 1,956
  • 1
  • 24
  • 34
0

This tutorial shows you how to set up the Azure PHP environment manually. You can choose the version of PHP you want to download and install. More tutorials that may help you can be found here.

NGhinazz
  • 9
  • 3
  • Thx for the link. But in this tutorial they only show how to set it up locally but I need an automated way to install the custom PHP version on the role instance. – ownking Mar 19 '12 at 13:48
  • You can package your custom PHP configuration in the Azure package. Azure will then use your custom configuration when it installs on the VM – NGhinazz Mar 20 '12 at 17:04
0

If you are looking to utilize your own custom PHP install on Windows Azure you should take a look at the "Using a custom PHP installation" tutorial available on the AzurePHP website at:

http://azurephp.interoperabilitybridges.com/articles/using-a-custom-php-installation

It lists the steps in detail on accomplishing a custom PHP install

Ben Lobaugh
  • 374
  • 1
  • 4