Monday, 12 September 2016

How to enable PHP extensions by adding modules to an Azure Web App

Using Azure, you can easily deploy a Web App (a website) that uses PHP.

An additional step that you may be required to perform is to enable additional PHP extensions that contain modules your PHP code uses.

For example, if you need to add the php_sockets.dll to the Web App, you would follow these steps:

  1. Obtain the extension dll, one way to do this is to download the correct PHP installation for windows from here
  2. Extract the PHP zip file and open the ext directory, locate the required dll file(s)
  3. Add FTP credentials to your Web App and log into your Web App using an FTP client
  4. Add a bin directory to the root directory here: D:\home\site\wwwroot
  5. Copy the dll files to the bin directory
  6. In Azure click on AppServices->"MyPHPWebApp"->Settings->Application Settings
  7. Under App Settings, create a PHP_EXTENSIONS key and add a value which is a relative path to the extension dll in the root directory, e.g. bin\php_sockets.dll


Once you save the application settings, you can run phpinfo() to check that the new extension has been loaded.

See this post for more details and an alternative method.

No comments:

Post a Comment