Homebrew-core: PHP 7.2 imagick

Created on 10 Apr 2018  路  15Comments  路  Source: Homebrew/homebrew-core

Hello,

I really don't know if this is correct place to ask this, but the old homebrew-php is deprecated...
I am running osx 10.13.3 and php 7.2.4 and cant get it to work with imagick.
I used to do a simple php(version)-imagick and it works, but php72-imagick doesn't exists anymore.

Anyone has a workaround or fix for this?

outdated

Most helpful comment

A lot of extensions are now part of the php binary itself (check php -m) if you want to install another extension you should use pecl.

All 15 comments

A lot of extensions are now part of the php binary itself (check php -m) if you want to install another extension you should use pecl.

@SMillerDev Solved it using pecl :)

Im trying to use the pecl but does not compile, this is how I solved, in case its of help of anyone.

brew install imagemagick
brew install pkg-config
pecl install imagick

and finally:

Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.4_1/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/Cellar/php/7.2.4_1/pecl/20170718/imagick.so'
install ok: channel://pecl.php.net/imagick-3.4.3
Extension imagick enabled in php.ini

Hello @kikoseijo , I'm doing your steps but I'm having the following error:
PHP Warning: PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/local/Cellar/php/7.2.4_1/lib/php/20170718/imagick.so (dlopen(/usr/local/Cellar/php/7.2.4_1/lib/php/20170718/imagick.so, 9): image not found), /usr/local/Cellar/php/7.2.4_1/lib/php/20170718/imagick.so.so (dlopen(/usr/local/Cellar/php/7.2.4_1/lib/php/20170718/imagick.so.so, 9): image not found)) in Unknown on line 0

Any idea how can I solve this?

Thank you!

EDIT: Issue is solved

I did not add the following line in the php.ini file:
extension = "imagick.so"

That's all 馃榾

Or a simple php restart, i didn't had to change anything in php.ini
Glad you got it working.

PHP Startup: Unable to load dynamic library '/usr/local/Cellar/[email protected]/7.1.17/lib/php/20160303/imagick.so' - dlopen(/usr/local/Cellar/[email protected]/7.1.17/lib/php/20160303/imagick.so, 9): no suitable image found.  Did find:
    /usr/local/Cellar/[email protected]/7.1.17/lib/php/20160303/imagick.so: file too short in Unknown on line 0

any ideas???

Did you try any of the suggestions in the thread?

ye, im completed with pecl

Installing '/usr/local/Cellar/[email protected]/7.1.17/include/php/ext/imagick/php_imagick_shared.h'
Installing '/usr/local/Cellar/[email protected]/7.1.17/pecl/20160303/imagick.so'
install ok: channel://pecl.php.net/imagick-3.4.3
Extension imagick enabled in php.ini

but still has that error

Do you have you extension directory in php.ini set to /usr/local/lib/php/pecl/<apib version>/?

yes, i have 20160303 DIR
and file
/usr/local/Cellar/[email protected]/7.1.17/pecl/20160303/imagick.so
also exists, but
/usr/local/Cellar/[email protected]/7.1.17/lib/php/20160303/imagick.so: file too short in Unknown on line 0

And you're getting this on the command line?

yes, im getting this error while using
php -v
P. S. i need php-imagemagick for project =(

Is /usr/local/Cellar/[email protected]/7.1.17/pecl/20160303/imagick.so a symlink? Cause Google tells me that sometimes gives the "file too short error" (none of this is homebrew issues by the way). And a lot of stack overflow solutions relating to shared libraries and "file too short" are just reinstalling the software.

Nope, imagick.so is not a symlink

total 832
-rw-r--r--  1 o.guz  staff  422456 May  3 14:42 imagick.so

Fixed this issue with next steps:

  1. Create in /usr/local/etc/php/7.1/conf.d file named ext-imagick.ini
    with content:
[imagick]
extension="/usr/local/Cellar/[email protected]/7.1.17/pecl/20160303/imagick.so"
  1. brew services restart [email protected]

Thanks for answers.
Maybe this information will be helpful for someone.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tejasmanohar picture tejasmanohar  路  3Comments

yuna9 picture yuna9  路  4Comments

faraazkhan picture faraazkhan  路  3Comments

dredmorbius picture dredmorbius  路  3Comments

xeoneux picture xeoneux  路  3Comments