How do I install ionCube on an Azure Web Site? - php

I am trying to follow the instructions under Using Custom PHP Extensions in Windows Azure Web Sites to enable the ionCube extension for PHP running within an Azure Web Site. Here's what I did:
Downloaded the Windows VC9 (Non-TS) (x86) loader from the ionCube loader download page.
Created a directory at /site/wwwroot/bin
FTP'd ioncube_loader_win_5.3.dll to that directory.
Under "app settings" in the Azure portal for the web site I added PHP_EXTENSIONS with value bin/ioncube_loader_win_5.3.dll.
I loaded http://my.azure.website/info.php and verified that the Environment table included PHP_EXTENSIONS = bin/ioncube_loader_win_5.3.dll. It also contains APPSETTING_PHP_EXTENSIONS = bin/ioncube_loader_win_5.3.dll.
When I try to load the site I get the message "The page cannot be displayed because an internal server error has occurred" and no additional information.
Is there something I forgot or is ioncube not supported on Azure? Did I set up the directory properly?
I also tried the Zend Guard Loader extension (ZendLoader.dll) in the same manner. I don't get an error message, but the extension doesn't show up in phpinfo() either.

I posted an article explaining How to configure ZendGuard on Windows Azure Web Sites

You shall not put the module in the root of the ftp site. The DLL module must reside in a folder below the APPLICATION ROOT, which is site/wwwroot/ So, you have to create either site/wwwroot/bin or anything of your choice (i.e. site/wwwroot/phpext), and then map PHP_EXTENSIONS again to bin/ioncube... (or phpext/iocube...), whatever is the name of your folder underneath site/wwwroot/!
However I am having trouble running any php page when the mentioned module is enabled. I don't know whether this is because my files are not ionCube encrypted, or because of some issue with the ionCube itself. So if you have a ionCube encrypted file, you have the chance to test.

ionCube is a Zend Extension, so according to an answer on windows azure forums:
The correct way to do it would be to create the /site/wwwroot/bin directory and upload ioncube_loader_win_5.4.dll there then add under the portal App Settings a PHP_ZENDEXTENSIONS setting with bin\ioncube_loader_win_5.4.dll as its value.
I confirm, but my tests was done in /site/phpext with an App Setting on ..\phpext\ioncube_loader_win_5.4.dll.

Related

Fatal error: Class 'XSLTProcessor' not found - but is installed

When try to do the following
$xsl = new XSLTProcessor();
I am getting this error
Fatal error: Class 'XSLTProcessor' not found in
I've seen this question about this exact same error (and this one) but I think this is different. Am I right in saying (I've tested it and appear to be) that because the extension details are shown in phpinfo() it is indeed installed correctly?
Is that the case, or would it always show in phpinfo() regardless of it being installed successfully? And do you know what might be causing the error if it is successfully installed?
I've tried several versions of PHP and for what it is worth I am hosted on Azure and have followed and checked the instructions here which further leads me to believe the extension is installed correctly.
How did you enable the php_xsl extension on Azure? If you manually upload the DLL library to Azure and config via Configure via ini settings section of How to: Enable extensions in the default PHP runtime. It maybe that the DLL library you configured doesn't match the PHP version or OS version.
However, Azure Web Apps has already contain the php_xsl.dll library in the ext folder of PHP runtime in every available version. But by default Azure PHP runtime doesn't enable it. you can login Kudu console site of your Azure Web App service, and direct to the default ext folder, e.g D:\Program Files (x86)\PHP\v7.0\ext. You can find all the libraries provided by Azure.
So, please delete your old configurations, and try to follow the Configure via ini settings section of How to: Enable extensions in the default PHP runtime, add the configuration in the extensions.ini:
extension=php_xsl.dll
Any further concern, please feel free to let me know.

Using Pthread in Azure web app in a PHP site

I have a webapp (PHP site using CodeIgniter) hosted on Azure. I have a situation where I want to use the pthread module. Since pthread is not available in PHP out of the box, when I install it using Xampp server, I suspect that it won't be possible to use threading on Azure.
But I am not sure. Azure documentation also doesn't talk about it. Is there a way I can use it pthread on Azure?
I am able to use it on my local Windows machine, using pthread.dll.
To enable extension in Azure Web APP, we should customize PHP runtime on Azure. Please refer to official site.
For this issue,I have tried to install pthreads successfully. And I toke those steps as following:
1, I obtained a PHP 5.4 (5.4.43) VC9 x86 Thread Safe package from PHP site explored to folder named PHP. And followed the pthreads site, got the lasted version of pthreads.
2,Added pthreadVC2.dll (included with the Windows releases) to the same directory as php.exe and added php_pthreads.dll to PHP extention folder.
3,I uesd phpinfo() to find default php.ini file in Azure, which should be similar with the picture:
,
Then I browsed Kudu Console of my web app via https://<your_web_app_name>.scm.azurewebsites.net/DebugConsole/?shell=powershell.
Locate to the directory found above. Download the content to local saved as php.ini in the PHP directory. Uncommented extension_dir = "ext" in this file.
4, Add a bin directory to your root directory (for example, bin\php), and use FTP tool to upload the PHP runtime on it.
5,Browse to the web app in the Azure Portal and click the configure tab.
Add *.php to the Extension field and add the path to the php-cgi.exe executable at the Handler mappings section.
At last, we check the PHP env,we should see the result as below
and run the test code of pthreads to check the extension
If you have any concern, please feel free to let me know.

On Windows 8 and Internet Information Service 8.5 - how to setup PHP?

Let me begin by saying that I am very new to Microsoft's Internet Information Service. I need to setup IIS on my PC and it should also execute PHP files. So far I got everything installed and running - the latest PHP and enabled IIS service. I can view the Default Webpages (*.html) files ONLY. It will not execute PHP files. If I try to request any PHP files, I get 403 error.
I have been researching online and seems to be more confused about setting up PHP (extension) on IIS. Some websites say you need to configure PHP through its MANAGER. Others say I need to add Role and FastCGImodule through IIS manager. According to Microsoft I need to rename php.ini-development to php.ini and point php to some DLL file.
I am using Windows 8, IIS 8.5 and PHP 5.6. I hope someone could point me in the direction.
You can set this up manually or with the IIS Manager. I would set this up my own, so you know whats going on.
You will need to setup the CGI role feature. This includes FastCGI. Here is some information how to do that: http://www.iis.net/configreference/system.webserver/cgi
Then you will need the PHP package somewhere. Lets say in C:\PHP. You can change that if you want.
You will need the fastCGI settings. You can easily set this up by commandline:
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='C:\php\php-cgi.exe',activityTimeout='1200',requestTimeout='1200',arguments='-c%20C:\php\php.ini']
This example uses a timeout of 20min.
This will set the handler:
%windir%\system32\inetsrv\appcmd set config /section:handlers /+[name='PHP_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='"C:\php\php-cgi.exe|-c%20C:\php\php.ini"',responseBufferLimit='0',resourceType='Either']
php.ini setup:
[cgi-fcgi]
fastcgi.impersonate=1
cgi.force_redirect=0
cgi.fix_pathinfo=1
For write access you will need to grant "modify" access for the the IURS.
More Information: http://php.net/manual/de/install.windows.iis7.php
I did try the answer posted to heart, but I kept running into problems. In fact, I also followed the Microsoft step by step PHP setup tutorial to the TEETH. I still couldn't get PHP working on my IIS. Although Microsoft warned against using Windows Platform Installer(WPI), I downloaded WPI and ran the installer. Under frameworks, I found PHP 5.6 and clicked on Add button. Then, clicked on the Install button. It took only about 30 seconds to install. Just to be sure. I checked IIS manager and there it was PHP Manager. After opening PHP manager I noticed that all the settings were there and enabled and it already had 15 different extension enabled. Plus, it also had about 35 extension disabled, but it gives you option to enable them right there.
Now, my PHP files are rendered as expected. I even did phpinfo(); and the browser displayed all the PHP settings and information. :)

PHP Websockets extension on Microsoft Azure website

I want to use web sockets on my PHP website hosted on Microsoft Azure.
For this I need to use the websockets extension php_sockets.dll.
I added the php_sockets.dll to my wwwroot/bin folder. I edited the app settings as followed:
But I get the following error in de log:
Unable to load dynamic library 'C:\DWASFiles\Sites\mywebsite\VirtualDirectory0\site\wwwroot\bin\php_sockets.dll' - The specified module could not be found.
Is Azure blocking it?
It worked for me! Here are some things to keep in mind:
Make sure you are downloading the php_sockets.dll from the PHP for Windows site
Make sure you download the proper version (for example, I'm running PHP 5.4 on my Azure Website, so I downloaded the PHP 5.4.40 ZIP file form the page listed above).
Make sure you download the VC9 x86 Non Thread Safe package.
As you mentioned in your question, create a folder titled bin in the wwwroot folder and place the DLL in this folder.
Follow the steps in the Azure documentation: Configure PHP in web apps)

Enabling PostgreSQL with custom PHP on Windows Azure

I have deployed a PHP web app connects to a PostgreSQL on Azure Website. Azure Website doesn't support to customize system level extensions to be enabled using .user.ini given within the wwwroot folder.
I went ahead with custom PHP installation and did the following
Copied PHP binaries as described under \bin\php folder
Modified under \bin\phpphp.ini has been modified with.
extension=php_pdo_pgsql.dll
extension=php_pgsql.dll
Added *.php* key and value D:\home\site\wwwroot\bin\php\php-cgi.exe under handler mappings
Added PHP extensions key PHP_EXTENSIONS and value D:\home\site\wwwroot\bin\php\ext under app settings configuration.
But when I look in to PHPInfo(), all the details are taken as configured but the extensions are not loaded.
I followed the guideline mentioned here - Using custom PHP Runtime
How to resolve this?
You have mixed the two different ways of bringing another dynamic extension to Azure Websites.
If you upload the php_pdo_pgsql.dll binary to D:\home\site\wwwroot\bin then add PHP_Extensions to the App Settings with the value bin\php_pdo_pgsql.dll it should fix your issues. if you have multiple extensions you want to enable, separate them with commas in the same App Setting value field
Alternatively, you could upload your own runtime, then you have full control over the php.ini which in included in the directory you upload the runtime to as described in using custom php runtime
Do note these are two separate options.

Categories