ionCube loader error on Azure IIS - php

I had the ionCube Loader working and running on an Azure web app for a few months. Then, about a week ago, PHP started throwing a fatal error regarding ionCube out of the blue. Haven't gotten it to work since. I didn't touch the server for several days prior to this error appearing.
PHP Error:
PHP Fatal error: [ionCube Loader] The Loader must appear as the first entry in the php.ini file in Unknown on line 0
I know this is usually caused by the wrong order of loading PHP extensions. Since I'm on Azure, I cannot fix the loading order in the usual way, since I have no direct access to the php.ini.
It was also working just fine for quite a long time.
My entry in Application Settings:
PHP_ZENDEXTENSIONS bin\ioncube_loader_win_5.5.dll
Any suggestions? Any more information I can provide?
UPDATE: After updating ionCube Loader, PHP now works. The loader doesn't show up as loaded in phpinfo however, and apps using it still can't pick it up. The Loader Wizard gives essentially the same error as I had before:
The ionCube Loader must be the first Zend extension listed in the configuration file, D:\local\Config\PHP-5.5.22\php.ini.

You can load your custom php runtime on Azure Web App. Instructions can be found here under "How to: Use a custom PHP runtime" section
https://github.com/Azure/azure-content/blob/master/articles/web-sites-php-configure.md
Once you configure custom php runtime, you can use your custom php.ini file in which you can define the order of loading for your extensions. Instructions on how to use custom php.ini can be found here:
https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples#using-a-custom-phpini

Related

Why is twig_template_get_attributes() throwing a fatal error?

I have twig installed via composer on a new codebase I'm working on (OSX), and on a new server I was trying install my app on. I started getting a fatal error on twig_template_get_attributes()
namely
PHP Fatal error: Call to undefined function twig_template_get_attributes() in /<path_to_here>/templates_c/a2/4e/3fbd69b54a0875d7cd3744d62bf1fa98ed4e7b1b375f904ead10b7cb27b6.php
I don't have this problem locally (OSX), and I was trying figure out why this is happening on my other server (Ubuntu 12.04 if that matters). When I install twig as a PHP extension the problem goes away, but my understanding is that the extension is completely optional and only optimizes one call
as per the documentation
The C extension is optional but it brings some nice performance
improvements. Note that the extension is not a replacement for the PHP
code; it only implements a small part of the PHP code to improve the
performance at runtime; you must still install the regular PHP code.
and
And from now on, Twig will automatically compile your templates to
take advantage of the C extension. Note that this extension does not
replace the PHP code but only provides an optimized version of the
Twig_Template::getAttribute() method.
very confused about this behavior.

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.

intl php extension exception zend framework 2 shared hosting

I finally managed to deploy my ZF2 site to a shared (and also free) hosting.
Everything seems to be working the right way, except a section that has a form.
This is the error I'm getting:
Uncaught exception 'Zend\Form\Exception\ExtensionNotLoadedException'
with message 'Zend\Form\View\Helper component requires the intl PHP extension' in
/.../vendor/zendframework/zendframework/library/Zend/Form/View/Helper/FormMonthSelect.php
In the form, there's a field where the user is supposed to select his/her birthday. I think that the problem is there.
How I'm i supposed to enable that extension in the server? Or at least, modify something in my zf2 application so it doesn't need that extension?
Your diagnosis is correct -- FormMonthSelect does require intl extension.
Managing php extensions is usually something done by sys admins, so you'd either ask the hosting company to enable it or try to squeeze that in through htaccess (iffy, edit .htaccess to load php extension?). Other then that I can only advise not to use anything that relies on intl, so maybe a simple text field with date parsing done by you manually.

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. :)

Old php site not working on new IIS server, need to use GD library but can't figure it out

I have been developing our php based site on a development box that was set up when i started my new job a few months ago. I have just got a new dev box and am having some real trouble getting my IIS server to work with the site.
I am running windows 7 64bit and IIS7.
I get this error when trying to load the site:
Fatal error: Call to undefined function imagecreatefromgif() in filepath:// line:#
I have done some searching around and found that this particular function is part of the GD library and that i needed to enable it in the php.ini file. most sites were saying that i needed to uncomment this line extension=php_gd2.dll but it wasn't there, so i added it. I took the php_gd2.dll file from the old test box and put it in the folder specified as so
extension_dir ="C:\Program Files (x86)\PHP\v5.2\ext"
I should point out that I am using php5.2 by necessity, we use a library called ezpdf to create pdfs and it contains hundreds of references to magic_quotes_runtime the old dev box was actually running php5.0 but i couldnt find anything earlier than 5.2, and as far as i can tell the magic quotes things should be an issue before php5.3.
Anyway, using the php manager in IIS7, i can see that php_gd2.dll is enabled, however if i look at phpinfo() i can see no reference to GD.
No matter what i try i get the same error, does anyone have any ideas!?
GD isn't JUST the .dll you load into php. there's a fair chunk of other code in other libraries that the php .dll references. You'll need the entire GD setup for it to work in IIS, not just the one php_gd.dll.
References to magic_quotes_runtime by themselves aren't 'bad' - a lot of libraries have to handle running under older PHP versions where magic_quotes is enabled by default, and do appropriate compensation for that fact. If ezpdf is, however, recreated magic_quotes behavior, then it's definitely time to upgrade versions or switching to something better. magic_quotes is deprecated for a reason, and re-enabling it in any way/shape/form is a bad idea.

Categories