Change default PHP settings in Windows Azure Pack (IIS WebFarm)

Had a user try to upload a theme to a WordPress site they had published using Windows Azure Pack but were getting a file exceeded size limit error as exampled below.

“The uploaded file exceeds the upload_max_filesize directive in php.ini”

Typically you would just go into the php.ini located on the local webserver but how do I do this in a WAP Websites WebFarm?

PowerShell of course!!!

Ok, I do this from the websites controller server:

Get-WebSitesConfig -Type ConfigFile

image_thumb.png

Next we copy the file out of the config to a local folder.

(Get-WebSitesConfig -Type ConfigFile -FileId PHP55INI).Content | Out-File c:\sysadmin\tempphp.ini

Open in your favourite editor (I use Notepad++ for light editing) and modify the desired settings. In my case it was the upload_max_filesize

image_thumb.png

Once complete, ‘upload’ the new version using the below..

Set-WebSitesConfig -Type ConfigFile -FileId PHP55INI -Content (Get-Content c:\sysadmin\tempphp.ini)

 

image_thumb.png

Here you will need to recycle the website. I just bounce my Web Workers but obviously this will temporarily stop access to your hosted sites.

Oh yes, you’ll need to modify this setting that pertains to the PHP version you are modifying or just repeat for each PHP version deployed.

Enjoy!
Dan

Leave a Reply

Your email address will not be published. Required fields are marked *