Unable to load Image ImageMagick for PHP on Azure - php

So, I have started to explore Azure, and trying to setup a PHP, MySQL on my Free Azure tier.
I have a WebApp setup on Azure, and phpinfo() is coming up nicely.
I am getting trouble setting up ImageMagick though.
I am on on the default PHP 5.4.42
I downloaded the extension dlls for ImageMagick from https://pecl.php.net/package/imagick/3.1.2/windows
Specifically, i got the http://windows.php.net/downloads/pecl/releases/imagick/3.1.2/php_imagick-3.1.2-5.4-nts-vc9-x86.zip file, which is nts version for PHP 5.4
Next, i followed the steps at https://azure.microsoft.com/en-us/documentation/articles/web-sites-php-configure/
I created a folder under my wwwroot folder called 'bin'. So now mu site path looks like /site/wwwroot/bin.
In this bin folder, i copied the php_imagick.dll file AND the other 8 Core_RL*.* files.
Next, In my Azure app settings, i added PHP_EXTENSIONS key, with value bin\php_imagick.dll
I then restarted my web app, but i am only getting the below error in my azure logs:
PHP Warning: PHP Startup: Unable to load dynamic library 'D:\home\site\wwwroot\bin\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
As alternatives, now I have changed my PHP version to 5.6(latest on Azure), and have put the corresponding version of imagick files from pecl site. This did not fix anything.
I have also tried the ini method, by creating ext and ini folders under the site folder, and creating the corresponding 'PHP_INI_SCAN_DIR' setting, but on restart of app, nothing shows up in the phpinfo(). Very sad :(
Please suggest what can I attempt to fix this issue.

Not all the versions of Imagemagick are compatible.
Here is a repo https://github.com/snobu/php-imagick-webapps that has the right resources referenced.
Download these resources (NTS Versions)
http://windows.php.net/downloads/pecl/releases/imagick/3.3.0rc2/php_imagick-3.3.0rc2-5.6-nts-vc11-x86.zip
http://www.imagemagick.org/download/binaries/ImageMagick-6.9.2-8-Q16-x86-dll.exe
Follow the steps in this Article, It just works http://blogs.msdn.com/b/azureossds/archive/2015/12/01/php-imagemagick-on-azure-web-apps.aspx

Related

Laravel 5.8 error 500 uploaded in shared hosting cpanel

I uploaded a laravel-5.8 project to a shared hosting cpanel.
The problem is when I access index.php it gives me an error 500.
Here is my project directory
I didn't transfer the public folder yet. but it should work when access.
stage.example.com/public/ instead it displays error 500.
I changed the database credentials.
I haven't changed the path in index.php since I didn't move the public folder yet.
path:index.php
I tried putting phpinfo.php in the root folder to check the requirements for laravel 5.8 all of this was met, except for the PHP version, according to phpinfo, PHP version is 5.6. but when I checked under myphpadmin>web server the PHP version is 7.2.7.
PHP >= 7.1.3
BCMath PHP Extension
Ctype PHP Extension
JSON PHP Extension
Mbstring PHP Extension
OpenSSL PHP Extension
PDO PHP Extension
Tokenizer PHP Extension
XML PHP Extension
I hope someone can help I wanted to run my laravel5.8 project in Cpanel.
I have answered this question in another post. Have a look at it and see if helps:
What is the easiest and quickest method to deploy a Laravel web application live?
I tried putting phpinfo.php in the root folder to check the requirements for laravel 5.8 all of this was met, except for the PHP version, according to phpinfo, PHP version is 5.6. but when I checked under myphpadmin>web server the PHP version is 7.2.7
I have no idea what "myphpadmin" is, anyway since you're running PHP 5.6 Laravel can't work.
In cPanel you should have an option to select the PHP version, select the latest available, 7.3 if your cPanel is updated.
If you have blank page maybe you need to change the path to the autoload.php file in index.php. This file is in vendor folder.
Change :
require __DIR__.'/bootstrap/autoload.php';
by
require __DIR__.'/vendor/autoload.php';

PHP Startup: Unable to load dynamic library php_pdo_firebird

I am trying to upload a 35Mb XML file.
But i got this error in the error_log from php
[22-Feb-2018 10:03:12 Europe/Belgrade] PHP Warning: PHP Startup:
Unable to load dynamic library 'C:\Program Files
(x86)\PHP\v5.6\ext\php_pdo_firebird.dll' - The specified module could
not be found.
How can i debug this??
The php_pdo_firebird.dll is only an interface between PHP and the firebird engine. So you need firebird installed and also the php-pdo-firebird.dll needs to be able to find fbclient.dll
Try copying fbclient.dll into \wamp\bin\php\php7.1.10
If you also need access from Apache you may need to copy fbclient.dll into \wamp\bin\apache\apache{version}\bin as well and also amend the php.ini file that controls PHP under apache. Do that by using the wampmanager menus to edit the correct php.ini file like this
left click wampmanager icon -> PHP -> php.ini
For me, it got fixed after copying fbclient.dll file into the php installation folder. You have to download the Zip kit for manual/custom installs from the firebird website. You can find the file there. 64 bit version worked.
Download the 32 bits zip package from the firebird site. in the bin dir there is a fbclient.dll. Copy this dll to the php dir. (Not to the extension dir) and everything works.
Answer Reference
Author Name: ronaldk
copying fbclient to php bin did not work for me (and I spent a whole day trying to copy different versions of it).. instead copy it to apache/bin folder and it works (for me it was 64x version that worked)
The best thing to do is simply comment it out if you don't need it
; PHP_PDO_FIREBIRD

Cannot load imagick library

I have installed the imagick from here (ImageMagick-7.0.3-1-Q16-x64-dll) and the dll (TS 32 bit) from here. And also copiend the CORE_RL_* to the C:\xampp\apache\bin BUT still i get the following error when i run the laravel server.
ERROR: Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_imagick.dll' - The specified module could not be found.
in Unknown on line 0
Also, I placed dll file in C:\xampp\php\ext\php_imagick.dll.
Also, the imagick is shown in the phpinfo().
And when i use it using laravel i get the following error.
getting Imagick to work on Windows has always been a bit hit and miss as pointed out here is a good guide
http://stackoverflow.com/a/36378764/1090867
But it misses an important point
You do not need to put the binary into the PHP folder!
So here are the steps I follow myself every time I need to do this. This should work for apache, Nginx, or IIS.
Step 1
find out your php version and setting
You need to version, Architecture, Compiler and Thread Safety
if Thread Safety is disabled this is NTS is enabled it will TS
Step 2
Get and install a copy of ImageMagick and make sure it matches your Architecture, this also needs to be dll.exe rather than the static version.
Regarding Q8 and Q16 I'll leave that to you but both versions will work
Link
I recommend changing the install directory name to something generic like
C:\Imagemagick since I've had some problems in the past with the default directory name with PHP and windows.
Just install but make sure you tick add application path and I normally tick the legacy utils as well.
Once it's installed go to your environment variables and make sure it is actually in the path. There is no need to copy anything to your PHP folder
Just to make sure everything is working open the command line and type convert --version you should get a response
Step 3
This unfortunately is the hard part and can be a bit of trial and error. I've found the following provides the best php_imagick.dll that seems to work 9 times out of 10
http://www.peewit.fr/imagick/
Just pick the version that matches your install.
If this doesn't work then go to php.net and try each version until one works... (start at the latest)
http://windows.php.net/downloads/pecl/releases/imagick/
Once you have a php_imagick.dll put it into your php/ext/ folder
thne locate your php.ini file go to the bottom (or whereever your extensions are) and add extension=php_imagick.dll
Step 4
Restart PHP (or your computer) and it should be working if not try a different php_imagick.dll and repeat.
If the above doesn't work
Then try a slightly older version of Imagick I normally use version 6.8.6-8 Q16.
Please note I've only ever really done this on Windows 7 and Windows Server 2008, 2008 R2, 2012, and 2012 R2 all x64 with x86 PHP
If this still doesn't work then you probably need to copy over the CORE_RL files into your Imagick directory this normally causes more issues but if you are running out ideas then give it a go
I just ran into this issue. Only I'm using PHP on the command line (PHP CLI). The problem is the dependencies that the main php_imagick.dll file has. PHP will attempt to load the extension but since Windows can't find the CORE_RL_ DLLs, the extension will fail to load and the error/warning message about being unable to load the DLL will appear. It helps to know how Windows loads DLLs:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682586(v=vs.85).aspx
It's pretty convoluted but you can see that the reason the Apache /bin directory trick works with Apache is that httpd.exe is located in that directory. However, when using PHP CLI, the DLLs need to be located in the same directory as php.exe.
If you don't want duplicate DLLs floating around, add the directory containing php.exe to the system PATH and plop all the CORE_RL_ DLLs there. The PATH is the last thing searched, but it'll work fine. If you don't want spurious entries in your system PATH, then set the extra PATH information only during startup of Apache.
This is because the dependencies are missing. Those who are facing the same error Unable to load dynamic library 'php_imagick', Please follow the below steps
Go to https://pecl.php.net/package/imagick choose a stable version and click on the DLL link.
From the DLL list click the link which, is suitable for your PHP version.
After downloading the php_imagick zip file, extract it and copy the php_imagick.dll file to C:\xampp\php\ext folder.
Extract all DLL files from the php_imagick zip file (except php_imagick.dll) to the PHP root directory (where you have php.exe). Ex: For XAMPP user C:\xampp\php folder.
Add extension=php_imagick to your php.ini file.
Restart the Apache server.
Things to keep in mind before choosing from the DLL list.
Check the PHP version.
Check the architecture (x64/x86).
Check Thread Safety (enabled/disabled).
N.B: Above solution is for XAMPP users only.
I changed php_imagick in php.ini file to php_imagick.dll and it happened
I had the same problem. It turns out I have to install complete ImageMagic application, not just ImageMagic php extension.
And I also set MAGICK_HOME environment variable.

GD2 library in PHP not installing

I'm having problems installing the GD library. I'm using an IIS server with PHP 5.2.14. I uncommented extension=php_gd2.dll in php.ini.
This is the error:
gd: Unable to initialize module
Module compiled with module API =20060613
PHP compiled with modlule API = 20090626
These options need to match
in Unknown on Line 0
I downloaded various PHP versions to try and get the correct DLL, including thread-safe 5.2.14. I would then restart my application pool and try to load a file that uses the GD library. Are there other files necessary for gd2 to work? Are there any quick ways to solve this without reinstalling PHP entirely?
first, iis7 was not configured properly for php - I searched for a guide that walked me through. Second the directory was incorrect, whenever I reset the iis server it originally would say one directory when ISAPI api was being used- but after 2 mins it would say extension_dir was in another directory when cgi/fastcgi is being used. So i created that directory that it wanted (which was different than any of my php.ini's). The one it was pulling from needed to be put in the C:/windows directory, but even though I had it set to go to "./ext" it wanted to go to Program files/PHP-- extremely weird. Third, I had to add IUSR to the permissions of any folder being used.

PHP APC Error Loading apc.so

I recently installed PHP APC on our server via our WHM panel (Web Host Manager). After a successful install, I thought everything was fine. However the next day I noticed our error_log file was getting quite large, after inspection I noticed the following line many times:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so: cannot open shared object file: No such file or directory in Unknown on line 0
Looking into the directory I do not see apc.so, but I also do not see it anywhere else on our server (maybe it is and I just haven't found it). Is there anyway I can generate this file to place into the proper folder? Will this work, or do I need to reinstall something or change a path in some file?
.so files are the equivalents of windows .dll files. you can't just whip one up. You'd have to extract it from the installation package (or recompile it if you started from source code). You can try doing find / -name apc.so to see where it's hiding on the system.

Categories