Part 1: Speeding up WordPress on Azure

Issue

WordPress page load times chronically slow in Azure.

Service config summary

App Service: WordPress
PHP Version: 7.0
Platform: x64
MySQL: ClearDB (Titan)

Change

Add the following lines to your web.config:

<configuration>
    <system.webServer>
         <handlers>
            <add name="PHP-FastCGI"
                path="*.php"
                verb="GET,HEAD,POST"
                modules="FastCgiModule"
                scriptProcessor="D:\Program Files\PHP\v7.0\php-cgi.exe"
                resourceType="Either"
                requireAccess="Script" 
                responseBufferLimit="0" />
         </handlers>
    </system.webServer>
</configuration>

Notes

  1. The path to php-cgi.exe will vary depending on your php version and your platform. I determined mine (just to be sure of the path) by connecting to the ftp site and going to /LogFiles/W3SVC<YourSiteID>/ and finding a failed request tracing xml, e.g. fr#####.xml and searching for php related items that appeared. From that I could see references to the path.
  2. You can get the FTP connection details from the overview for the app service. Click on “Get publishing profile” and in the file will be the details you need to connect using your FTP client of choice.

References

https://stackoverflow.com/questions/36755558/wordpress-slow-on-azure

Conclusion

Did it speed up? Yes… but not enough. Part 2 deals with migrating away from ClearDB which is generally considered to have suboptimal.