homebrew -- Image Magick throwing version error when executing Php - php

PHP execution is throwing a Warning about Imagick...
Output of php -v:
PHP Warning: Version warning: Imagick was compiled against Image Magick
version #### but version #### is loaded. Imagick will run but may behave
surprisingly in Unknown on line 0

You have certainly upgraded imagick after installing PHP, so you need to reinstall imagick using pecl.
Run the following:
sudo pecl uninstall imagick
sudo pecl install imagick
If you run php -v and see a warning saying that the module imagick was already loaded, check your ini file:
php -i | grep 'Configuration File'
Then open the file and remove duplicate entries of extension="imagick.so". You might need to look into the configuration path to check also other ini files.

php##-imagick needs to be rebottled
brew reinstall --build-bottle php56-imagick
OR
brew reinstall --build-bottle php71-imagick
make sure you use the reinstall command and the proper php## version
Reference to solution on github.com

If you want, you can make the correction by creating a file called ".user.ini" in the root directory of the domain or sub-domain in question and placing the following line inside it:
imagick.skip_version_check = true

The solution is:
Create a file called .user.ini
Type the following into the file.
imagick.skip_version_check=true
Save the file in the top-level folder for the site.

Related

PHP Warning: PHP Startup: Unable to load dynamic library '/path/to/extension/mysqli.so' [duplicate]

I run a PHP script and get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0
What does that mean?
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
If you're on Linux, you can find all loaded configuration files by typing this in shell:
php -r "print phpinfo();" | grep ".ini"
UPDATE:
As mentioned in comments, this can be even more accurate:
php -i | grep ini
phpStom with XAMPP
TL;DR Except from verifying that the files exist, you might need to add the drive letter to some records in your php.ini file
I suddenly started having a problem using phpStorm 7 for debugging php with xampp and xdebug. When trying to set intellij interperter to be xampps php I got a lot of the warnings like the one in the question, for example:
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
For some reason I had to add my drive letter to the records of extension_dir and browscap in the php.ini file:
extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"
to
extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"
If you just want to make the error disappear, and you don't need the extension, then by all means comment the line out in php.ini. But if you actually want to fix the problem here is some additional info.
There are various causes for this based on the exact module, but there are also some general guidelines.
Open phpinfo() and look for extension_dir under the Core section. This is where your modules should be located.
For instance, /usr/lib/php/modules for Unix/Linux.
If the file does in fact exist, make sure permissions are adequate.
If the file does not exist, use the resources below to install it.
Installation on *nix (PEAR)
Installation of extensions on Windows
Loading .dll in Linux
I've encountered this warning message while I was trying to install a php-extension via the php.ini file;
until I figured out that you cannot load .dll extensions in Linux,
but you have to comment the extensions that you want to import ;extension= ... .dll and install it correctly via sudo apt-get install php-...
note: ... is the extension name you want to enable.
php -r "echo php_ini_loaded_file();"
Will show in CLI current ini loaded file, search there for Your extension, path to it is incorrect.
In my case, this message started to appear when I updated the php version to 7.4.
To solve it I had to look for the php.ini files found inside the php version folder (/etc/php/7.4/apache2/ && /etc/php/7.4/cli/) checking the lines where the extensions I could see that the extensions gd2 and intl were uncommented.
Note that you can also get this error if your PHP library doesn't have the "other" directory opening permission. In my particular case, I noticed this when using php -l to syntax check a script in my text editor. This meant that since my account was called "volomike", that account didn't have permission to run the libraries that the php command relied upon.
For instance, on Ubuntu 14.04, I had PHP5 installed automatically into the path /usr/lib/php5/20121212+lfs. However, because I was working in C++ in building some shared objects, I messed around with the directory permissions and screwed things up such that non-root accounts did not have the directory execute (directory open) permissions to view /usr/lib/php5/20121212+lfs. So, I typed the following command to rectify that problem:
sudo chmod o+x /usr/lib/php5/20121212+lfs.
Now when I do php -l example.php as a non-root user, it never gives me this "Unabled to load dynamic library" problem anymore.
I had the same problem on XAMPP for Windows when I try to install composer.
I did php -v and php throwing error :
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
It took me a while until I realized that I need to setup my XAMPP. So I run setup_xampp.bat and php return to works like a charm.
I had this error on a number of modules when I had been running different versions of PHP side by side on my server. To sort this out, I needed to install the packages it couldn't find for that specific PHP version. So, for example, if I saw:-
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'
I would install the library for the PHP version specifically:-
sudo apt-get install php7.1-xml
And then restart Apache. Fixed it for me. You can check your version like this:-
php -v
I had the same problem on XAMPP for Windows10 when I try to install composer.
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
Then follow this steps
just open your current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini in texteditor (like notepad++)
now just find - is the current_xampp_containing_drive:\xampp exist?
if not then find the "extension_dir" and get the drive name(c,d or your desired drive) like.
extension_dir="F:\xampp731\php\ext" (here finded_drive_name_from_the_file is F)
again replace with finded_drive_name_from_the_file:\xampp with current_xampp_containing_drive:\xampp and save.
now again start the composer installation progress, i think your problem will be solved.
What I did was;
1 - I first find out what version of PHP I am using thru the function phpinfo()
<?php
phpinfo();
?>
2 - From there you will find the location of your configuration(php.ini) file
3 - Open that file
4 - Comment out the line similar to the image below
This might be a different value but it should be related to extension.
I am no expert but this process helped me solved similar problem.
In my case I got this error because I downloaded a thread-safe version of the dll (infixed with -ts-), but my installation of php was a non-thread-safe (infixed with -nts-). Downloading the right version of the dll, exactly matching my php installation version fixed the issue.
After Windows 10 XAMPP now I installed LAMPP (XAMPP) on Ubuntu. Windows XAMPP had a lot less to configure compare to MAC (iOS) but now with Linux Ubuntu I had a few more since there are more going in Linux (a good thing).
I confused and activated mysqli.dll (and mysql.dll: erase "#" in /etc/php/7.2/cli/php.ini
I started to get the PHP Warning: PHP Startup: Unable to load dynamic library message related to dll. I commented out mysql(and i).dll in the same file but the message didn't go away up until I commented out " " in /opt/lampp/etc/php.ini.
Looks like XAMPP reads php.ini file from /etc/php/7.2/cli and makes modification in php.ini of /opt/lampp/etc. (;extension=php_pdo_mysql.dll after ";" restarted Apache and no more any message.
I encountered a similar error. The mistake I made was to use the "controller" name as "Pages" instead of "pages" in my url.
In Windows, it could be a wrong path in "System environment variables".
"Path" to the php.exe directory must be the good one.
'C:/PHP/5.2.13/ext\php_mcrypt1.dll'
I'd say there's some typo on your php.ini (the extra 1). Perhaps you're loading a different php.ini from what you expect (see the output of php.ini to make sure).
Other than that make sure that php_mcrypt.dll and PHP:
Were linked to the same VC runtime library (typically msvcrt.dll for VC6 or msvcrt90.dll for VC9) – use e.g. the dependency walker for this
Are both debug builds or both release builds
Both have ZTS enabled or ZTS disabled
For libraries that depend on further libraries (DLLs), make sure they are available (e.g. in the same directory as the extension)
PHP should give you meaning errors if any of the first three conditions above is not satisfied, but I wrote those anyway because I'm not sure for PHP 5.2.
From C:\xampp\php\php.exe I got
Unable to load dynamic library ''
C:\xampp\php\ext\php_.dll (The specified module could not be found.)
I solved by commenting out
C:\xampp\php\php.ini
;extension=
I had the same problem when I tried to use php with sql server, when I added the sqlsrv libraries ... it gave me the error, after several days of researching there, I understood that microsoft does not support x64 in this case so what I did was install laragon x86 and use the corresponding libraries. I hope it helps with something
Go to system env variable and set the php ext dir path as
C:\xampp\php\ext
basically it's finding the ext directory and then locating it's file but it's unable to find the files becuase php path is set as different.

Enable MCrypt using MAMP

I'm using MAMP and ive installed a fresh version of Opencart, its telling me i dont have MCrypt enabled, when i go to terminal and type:
php -m | grep mcrypt
output: mcrypt
I can locate the library but it doesn't seem to be enabled.
That fact that php -m | grep mcrypt returns mcrypt, means the mcrypt library is INSTALLED and ENABLED.
Although it may just be enabled for CLI.
You can try editing the PHP.ini file and adding the following line under the ; Extensions section:
extension=mcrypt.so
Restart Apache / MAMP after saving php.ini file.
To find the correct php.ini file to edit, run the following command line:
php --info | grep php.ini
(If the line already exists, you may just need to remove the ; thats in front of it.)
I have tried so many ways but had no luck.
After a lot of trials finally came up with a solution.
Go to bin directory inside current active PHP version directory. In my case it is /Applications/MAMP/bin/php/php7.2.8/bin
It might be different in your case. Now run the below command with sudo
sudo ./pecl install channel://pecl.php.net/mcrypt-1.0.1
Now You should add extension=mcrypt.so to php.ini
Restart MAMP Service and check if it is working.
I had this issue following upgrading to MAMP 5.1 and using PHP 7.1.20...
The issue I found was not that MAMP PHP did not have mcrypt installed, it certainly does come bundled.
The issue was that the MAMP PHP configuration option "Make this version available on the command line" was NOT working and so the version of PHP I was using on the command line [in my case] was the macOS default PHP 7.1.16 without mcrypt (the version included in macOS by default)
Reverting to the old cli php alias meant the correct MAMP version of PHP was used on the command line
Added to .bash_profile
alias php='/Applications/MAMP/bin/php/php7.1.20/bin/php'
try in console
pecl install mcrypt
Using Brew:
Install mcrypt: brew install mcrypt
In Mamp: File -> Edit Template -> PHP (php.ini)-> {PHP version}
Find 'Dynamic Extensions' in the text and add the following below (after the lines starting with ';'):
extension=mcrypt.so
Save, restart and test (with php -i | grep mcrypt for example)

php.ini extension not found Windows 10 [duplicate]

I run a PHP script and get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/ixed.5.2.lin: cannot open shared object file: No such file or directory in Unknown on line 0
What does that mean?
It means there is an extension=... or zend_extension=... line in one of your php configuration files (php.ini, or another close to it) that is trying to load that extension : ixed.5.2.lin
Unfortunately that file or path doesn't exist or the permissions are incorrect.
Try to search in the .ini files that are loaded by PHP (phpinfo() can indicate which ones are) - one of them should try to load that extension.
Either correct the path to the file or comment out the corresponding line.
If you're on Linux, you can find all loaded configuration files by typing this in shell:
php -r "print phpinfo();" | grep ".ini"
UPDATE:
As mentioned in comments, this can be even more accurate:
php -i | grep ini
phpStom with XAMPP
TL;DR Except from verifying that the files exist, you might need to add the drive letter to some records in your php.ini file
I suddenly started having a problem using phpStorm 7 for debugging php with xampp and xdebug. When trying to set intellij interperter to be xampps php I got a lot of the warnings like the one in the question, for example:
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
For some reason I had to add my drive letter to the records of extension_dir and browscap in the php.ini file:
extension_dir = "\xampp\php\ext"
browscap = "\xampp\php\extras\browscap.ini"
to
extension_dir = "e:\xampp\php\ext"
browscap = "e:\xampp\php\extras\browscap.ini"
If you just want to make the error disappear, and you don't need the extension, then by all means comment the line out in php.ini. But if you actually want to fix the problem here is some additional info.
There are various causes for this based on the exact module, but there are also some general guidelines.
Open phpinfo() and look for extension_dir under the Core section. This is where your modules should be located.
For instance, /usr/lib/php/modules for Unix/Linux.
If the file does in fact exist, make sure permissions are adequate.
If the file does not exist, use the resources below to install it.
Installation on *nix (PEAR)
Installation of extensions on Windows
Loading .dll in Linux
I've encountered this warning message while I was trying to install a php-extension via the php.ini file;
until I figured out that you cannot load .dll extensions in Linux,
but you have to comment the extensions that you want to import ;extension= ... .dll and install it correctly via sudo apt-get install php-...
note: ... is the extension name you want to enable.
php -r "echo php_ini_loaded_file();"
Will show in CLI current ini loaded file, search there for Your extension, path to it is incorrect.
In my case, this message started to appear when I updated the php version to 7.4.
To solve it I had to look for the php.ini files found inside the php version folder (/etc/php/7.4/apache2/ && /etc/php/7.4/cli/) checking the lines where the extensions I could see that the extensions gd2 and intl were uncommented.
Note that you can also get this error if your PHP library doesn't have the "other" directory opening permission. In my particular case, I noticed this when using php -l to syntax check a script in my text editor. This meant that since my account was called "volomike", that account didn't have permission to run the libraries that the php command relied upon.
For instance, on Ubuntu 14.04, I had PHP5 installed automatically into the path /usr/lib/php5/20121212+lfs. However, because I was working in C++ in building some shared objects, I messed around with the directory permissions and screwed things up such that non-root accounts did not have the directory execute (directory open) permissions to view /usr/lib/php5/20121212+lfs. So, I typed the following command to rectify that problem:
sudo chmod o+x /usr/lib/php5/20121212+lfs.
Now when I do php -l example.php as a non-root user, it never gives me this "Unabled to load dynamic library" problem anymore.
I had the same problem on XAMPP for Windows when I try to install composer.
I did php -v and php throwing error :
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
It took me a while until I realized that I need to setup my XAMPP. So I run setup_xampp.bat and php return to works like a charm.
I had this error on a number of modules when I had been running different versions of PHP side by side on my server. To sort this out, I needed to install the packages it couldn't find for that specific PHP version. So, for example, if I saw:-
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20160303/xml.so'
I would install the library for the PHP version specifically:-
sudo apt-get install php7.1-xml
And then restart Apache. Fixed it for me. You can check your version like this:-
php -v
I had the same problem on XAMPP for Windows10 when I try to install composer.
Unable to load dynamic library '/xampp/php/ext/php_bz2.dll'
Then follow this steps
just open your current_xampp_containing_drive:\xampp(default_xampp_folder)\php\php.ini in texteditor (like notepad++)
now just find - is the current_xampp_containing_drive:\xampp exist?
if not then find the "extension_dir" and get the drive name(c,d or your desired drive) like.
extension_dir="F:\xampp731\php\ext" (here finded_drive_name_from_the_file is F)
again replace with finded_drive_name_from_the_file:\xampp with current_xampp_containing_drive:\xampp and save.
now again start the composer installation progress, i think your problem will be solved.
What I did was;
1 - I first find out what version of PHP I am using thru the function phpinfo()
<?php
phpinfo();
?>
2 - From there you will find the location of your configuration(php.ini) file
3 - Open that file
4 - Comment out the line similar to the image below
This might be a different value but it should be related to extension.
I am no expert but this process helped me solved similar problem.
In my case I got this error because I downloaded a thread-safe version of the dll (infixed with -ts-), but my installation of php was a non-thread-safe (infixed with -nts-). Downloading the right version of the dll, exactly matching my php installation version fixed the issue.
After Windows 10 XAMPP now I installed LAMPP (XAMPP) on Ubuntu. Windows XAMPP had a lot less to configure compare to MAC (iOS) but now with Linux Ubuntu I had a few more since there are more going in Linux (a good thing).
I confused and activated mysqli.dll (and mysql.dll: erase "#" in /etc/php/7.2/cli/php.ini
I started to get the PHP Warning: PHP Startup: Unable to load dynamic library message related to dll. I commented out mysql(and i).dll in the same file but the message didn't go away up until I commented out " " in /opt/lampp/etc/php.ini.
Looks like XAMPP reads php.ini file from /etc/php/7.2/cli and makes modification in php.ini of /opt/lampp/etc. (;extension=php_pdo_mysql.dll after ";" restarted Apache and no more any message.
I encountered a similar error. The mistake I made was to use the "controller" name as "Pages" instead of "pages" in my url.
In Windows, it could be a wrong path in "System environment variables".
"Path" to the php.exe directory must be the good one.
'C:/PHP/5.2.13/ext\php_mcrypt1.dll'
I'd say there's some typo on your php.ini (the extra 1). Perhaps you're loading a different php.ini from what you expect (see the output of php.ini to make sure).
Other than that make sure that php_mcrypt.dll and PHP:
Were linked to the same VC runtime library (typically msvcrt.dll for VC6 or msvcrt90.dll for VC9) – use e.g. the dependency walker for this
Are both debug builds or both release builds
Both have ZTS enabled or ZTS disabled
For libraries that depend on further libraries (DLLs), make sure they are available (e.g. in the same directory as the extension)
PHP should give you meaning errors if any of the first three conditions above is not satisfied, but I wrote those anyway because I'm not sure for PHP 5.2.
From C:\xampp\php\php.exe I got
Unable to load dynamic library ''
C:\xampp\php\ext\php_.dll (The specified module could not be found.)
I solved by commenting out
C:\xampp\php\php.ini
;extension=
I had the same problem when I tried to use php with sql server, when I added the sqlsrv libraries ... it gave me the error, after several days of researching there, I understood that microsoft does not support x64 in this case so what I did was install laragon x86 and use the corresponding libraries. I hope it helps with something
Go to system env variable and set the php ext dir path as
C:\xampp\php\ext
basically it's finding the ext directory and then locating it's file but it's unable to find the files becuase php path is set as different.

Tesseract PHP wrapper failed to open file

There is a Open source PHP wrapper class for Tesseract (https://github.com/thiagoalessio/tesseract-ocr-for-php) but i'm having problems using it:
Installed it successfully with composer, but when I call
$tesseract = new TesseractOCR('img/c11a67cdd171790771fcf33ec78461d9.png');
$tesseract->setTempDir('/var/www/dir_name/imgRead/');
$tesseract->setWhitelist(range(0,9));
When I run echo $tesseract->recognize(); I get
Message: file_get_contents(/var/www/dir_name/imgRead/573534798.txt):
failed to open stream: No such file or directory
The author says:
IMPORTANT: Make sure that the tesseract binary is on your $PATH
but i'm not sure what this means exactly, how can I check that the binary is on my $PATH? Anyone use this before?
check your environment variable if the binary for Tesseract is added in your path issue printenv command on your terminal, you should see something like
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin"
if it does not exist, add something like in your ~/.profile
export PATH=$PATH/usr/bin:/path/to/your/tesseract
or you can check out different ways on how to add one here
Try setting your path via PHP using
$path = getenv('PATH');
putenv("PATH=$path:/usr/local/bin");
where /usr/local/bin is the location where you installed Tesseract.
Hi I have the self Problem. Is there somebody how have a solution?
My Path is:
PATH=/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin
My Path to tesseract is:
tesseract: /usr/local/bin/tesseract
I use Cent OS 6 and the new PHP
The problem might be related to the installation of Tesseract, on terminal check tesseract by
$ tesseract -v
make sure the output is close to this output. should have these libs, if its missing the libs then Tesseract is not writing txt file anywhere and that's why it can't find it.
this is my output on centos 6
tesseract 3.02.02
leptonica-1.73
libjpeg 6b (libjpeg-turbo 1.2.1) : libpng 1.2.49 : libtiff 3.9.4 : zlib 1.2.3
Check if TesseractOCR is installed in your system, if not:
sudo apt-get install tesseract-ocr
Tesseract-ocr-php is simply doing an exec(cammande) on system installed TesseractOCR

Enabling/Installing Curl Extension (OSX Server/PHP 5.3.3/Apache 2.2)

I've been having some trouble getting CURL working with PHP on a server I inherited.
So far I have enabled the extension in my php.ini by uncommenting the extension=php_curl.dll line, and restarting apache.
However, I now receive the following error when starting PHP:
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/local/lib/php/extensions/php_curl.dll
The php_curl.dll file doesn't exist in the aforementioned directory, and I can't find anywhere legitimate to download it from(doesn't seem to be included in PHP, or Curl).
UPDATE
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.
Why don't use
sudo port install php5-curl
(on php54: php54-curl)?
Download the 'port' using the following URL and install it:
http://www.macports.org/install.php
There are different versions and you can select one installation pack for your Mac Version.
After installed, open a terminal and type the following command to install directly,
$ sudo port install php5-curl
Otherwise
- Login to port terminal by just typing
$ sudo port
and type
> install php5-curl
It will get few minutes to install all the dependancies and finally you will see the following message
---> No broken files found.
Following the steps provided in the answer here, I was able to compile a new php_curl.so file and install it to the extensions directory.
Cudos go to Francois Deschenes!!
To compile a curl.so (php_curl.dll) module from scratch:
Download and extract a new copy of your version of PHP.
Open a terminal window and go to the curl directory (Type cd php-5.3.3/ext/curl/).
Type phpize.
Type ./configure.
Type make.
Type sudo make install.
Uncomment extension=curl.so in your php.ini.
You should also make sure the extension is commented out before you start the processes, otherwise you may receive an error about the module already existing.

Categories