PHP 5.5.3 installing Imagick extension for ImageMagick - php

So we have this machine with Linux running as development server.
However we are having som issue's getting the imagick extension installed.
We are using:
PHP 5.5.3 (cli) (built: Aug 21 2013 18:12:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
And
Version: ImageMagick 6.5.4-7 2012-05-07 Q16 OpenMP http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
If we try to install imagick with this command we get the following:
# pecl install imagick
downloading imagick-3.1.2.tgz ...
Starting to download imagick-3.1.2.tgz (94,657 bytes)
.....................done: 94,657 bytes
15 source files, building
running: phpize
Can't find PHP headers in /usr/include/php
The php-devel package is required for use of this command.
ERROR: `phpize' failed
How can we do the install correct without changing our PHP version to a dev version.
Is there a version of imagick for PHP 5.5.3 or a version of imagick we can use with our PHP version.
Help would really be appreciated!

as root, execute the following command
yum install php-devel
Then try installing the imageMagick extension again

We managed to installed the extension by removing the old php installed package because it was from a different repository. After that we installed everythings from the same repository. After that we needed to added some non default extensions back in php.ini to let everything work again! Don't know the exact details,I'm no unix expert ;).

Related

PECL fails to install Xdebug on PHP 8.1 because it thinks I'm on PHP version 7.4

I've searched far and wide, tried everything but I can't get to install Xdebug on PHP 8.1
I've got multiple PHP versions installed via homebrew, when I switch to PHP 8.1 and try to install Xdebug I get the following:
BE-C02CRC3FMD6N:~ treynaert$ php -v
PHP 8.1.14 (cli) (built: Jan 9 2023 16:02:41) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies
BE-C02CRC3FMD6N:~ treynaert$ pecl install xdebug
pecl/xdebug requires PHP (version >= 8.0.0, version <= 8.2.99), installed version is 7.4.33
No valid packages found
install failed
As you can see, php -v returns 8.1, phpinfo() in the browser gives me the same. Though for some reason pecl thinks I'm on 7.4.
I'm on Mac OSX Catalina BTW (10.15.7)
Anyone has a clue?

Install xdebug on specific php version

I'm trying to install xdebug.
I've already seen some issues about it (like this one : Installing xdebug with PHP 5.5 ) but it seems outdated and not corresponding to my issue).
When I try
sudo pecl install xdebug
I'm getting the following error
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading xdebug-2.8.0.tgz ...
Starting to download xdebug-2.8.0.tgz (238,122 bytes)
.................................................done: 238,122 bytes
69 source files, building
running: phpize
sh: 1: phpize: not found
ERROR: `phpize' failed
It seems that means phpize isn't installed in my php version
php -v
PHP 7.2.24-0ubuntu0.19.04.1 (cli) (built: Oct 24 2019 11:49:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.19.04.1, Copyright (c) 1999-2018, by Zend Technologies
So, some topics seems to tell me to change my php version to download a version with phpsize included. But I was more looking for a way to add phpsize to my current php version but I don't know how to do that.
Thanks for your assistance
If Ubuntu first you need install php dev version:
sudo apt install php7.x-dev
And then:
sudo pecl install xdebug
I had some problems with xdebug version too.
I had to install an specific version for php7.1 using PECL,
I don't really know if your question is already solved but let me share you this webpage, it's the compatibility graph to know wich version works with an specific php versions:
https://xdebug.org/docs/compat
As far as I know if you want to install the latest xdebug version you can use the repo, but if you need an old version you'll be forced to install it using PECL.
Hope you find this answer usefull!

Why is php zip extension not working on ubuntu though it's installed?

I'm on Ubuntu 16.04 and I'm trying to install prestashop e-commerce CMS that requires php zip extension to unzip the main CMS folder.
I have installed php-zip and php7.2-zip and I also restarted the web server (apache2) but the CMS still displays the following message
An error has occured:
You must install PHP zip extension first
Here's the result of my installed php zip packages and my current php version:
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ php -v
PHP 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: May 5 2018 04:59:13) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
eljaouhari#eljaouhari-HP-350-G1:/var/www/html$ apt list --installed | grep php | grep zip
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
php-zip/xenial,xenial,now 1:7.2+60+ubuntu16.04.1+deb.sury.org+1 all [installé]
php7.2-zip/xenial,now 7.2.5-1+ubuntu16.04.1+deb.sury.org+1 amd64 [installé]
I spent an hour and a half trying to figure out whether I need to activate the extestion on the php.ini file and also installing and reinstalling and restarting the web server but nothing seems to work.
I have tried a few solutions on the web that used to work for me but I can't seem to find a good solution.
Please help me with your experience!
I've found the solution after I printed the results of the phpinfo() function.
It seems that the version of php printed with the "php -v" command is not the version that actually apache is using. Apache ended up using the 7.0 version.
Thanks everyone.

No package php-opcache available

I found so many questions here but whatever i try i always get the msg
No package php-opcache available
i tried to follow this
http://www.unixmen.com/install-remi-repository-rhel-centos-scientific-linux-76-x5-x-fedora-201918/
then install opcache
# yum install php-opcache
but still no luck
PS: i have WHM/Cpanel installed on my AWS server and i need to install opcache for Magento
i have PHP version 5.5
PHP 5.5.35 (cgi-fcgi) (built: May 16 2016 18:26:28)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
i tried to enable it from php.ini but it says opcache.so not found
any help would be appreciated
Failed loading /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so: cannot open shared object file: No such file or directory
If you're installing from Remi's repo, the name will be php55-php-opcache, which you could have determined from running yum search opcache.
But your error refers to /usr/local/lib/php/extensions/no-debug-non-zts-20121212/opcache.so which tells me that you have a version of PHP that was compiled from source. You need to either use packages or compile from source, not both. If you install from a package, things will not be put into /usr/local/.

centOS 6.7 - install imagick php

trying to install imagick extension for php (here is the env):
[root#localhost src]# cat /etc/*release*
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
cpe:/o:centos:linux:6:GA
[root#localhost src]# php -v
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
---------------
[root#localhost src]# pecl install imagick
downloading imagick-3.3.0.tgz ...
Starting to download imagick-3.3.0.tgz (179,978 bytes)
.................done: 179,978 bytes
17 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
Please provide the prefix of Imagemagick installation [autodetect] :
building in /var/tmp/pear-build-armandPkqjM8/imagick-3.3.0
running: /var/tmp/imagick/configure --with-imagick
.....
-- I'm getting this error in the end... Anyone can help? Thanks in advance!
/var/tmp/imagick/imagick.c:3299: error: ‘ZEND_MOD_END’ undeclared here (not in a function)
make: *** [imagick.lo] Error 1
ERROR: `make' failed
I faced the same problem. The possible solution is to install it from source following the steps:
cd /usr/local
wget http://pecl.php.net/get/imagick-3.3.0.tgz
tar zxvf ./imagick-3.3.0.tgz
cd imagick-3.3.0
phpize
./configure
make
make test
Then, you'll get the same error. To fix this, edit the file where the variable is undeclared:
vim /usr/local/imagick-3.3.0/imagick.c
to something like this:
3298 #endif
3299         // ZEND_MOD_END
3300         {NULL, NULL, NULL}
3301 };
3302 #endif
and try running again:
make test
make install
Hope this helps.
Since a (patched) php-5.3.3 is what comes with RHEL/CentOS 6 upgrading php is not always feasible. To build the imagick pecl module for CentOS 6 use version 3.1.2.
$ pecl install imagick-3.1.2

Categories