SyntaxC4-MSFT / ComposerExtension

Brings Composer Support to Azure Websites via a Site Extension
http://www.siteextensions.net
MIT License
15 stars 7 forks source link

Load custom PHP extensions when running composer #7

Closed metaclassing closed 6 years ago

metaclassing commented 9 years ago

Azure does not auto-load PHP binary extensions (such as LDAP). The user must upload their own copy of the binary (compatible for the configured version of PHP) and then either alter the website settings to load it or upload a custom .user.ini file specifying the extension=D:\path\to\wwwroot\somedir\extension.dll

Some composer install commands fail (such as Adldap/Adldap) if the interpreter running composer does not have the binary extension required for the library to operate loaded, even if the IIS invoked PHP interpreter does.

I ended up editing my deploy script to -dextension=D:\path\blah\my.dll and that resolved it temporarily however does not autoload additional libraries if the website variable or .user.ini file is updated. Is there any way the default composer extension can attempt to load additional configuration files to avoid this issue?

SyntaxC4 commented 9 years ago

you could also use a PHP_INI_SCAN_DIR to provide a path to add additional extensions to the SYSTEM level php.ini (which will get loaded on both the command line and web server)

Documentation available on Configuring PHP on Azure Web App

metaclassing commented 9 years ago

PHP_INI_SCAN_DIR was one of the solutions I tested, it did not appear to load anything for the CLI environment, only the webserver. phpinfo(); from http showed the module loaded while the CLI php interpreter was still unaware.

SyntaxC4 commented 9 years ago

Can you share the ini file that you placed in the scan dir?

On Sun, Sep 6, 2015, 5:35 AM metaclassing notifications@github.com wrote:

PHP_INI_SCAN_DIR was one of the solutions I tested, it did not appear to load anything for the CLI environment, only the webserver. phpinfo(); from http showed the module loaded while the CLI php interpreter was still unaware.

— Reply to this email directly or view it on GitHub https://github.com/SyntaxC4-MSFT/ComposerExtension/issues/7#issuecomment-138080225 .

metaclassing commented 9 years ago

Sure, this is the complete contents of extensions.ini which was placed in the scan dir:

; Enable Extensions
extension=D:\home\site\wwwroot\bin\php_ldap.dll

The included DLL file is part of the deployed package and corresponds with the configured version of PHP for this Azure website. It worked fine when I specified the manual path to include via the CLI.

peterpostmann commented 7 years ago

Using PHP_INI_SCAN_DIR with extensions.ini solved the problem for me. PHP_EXTENSIONS still doesnt work for the CLI environment.