Install xDebug with PECL on High Sierra - php

I just updated my mac from Sierra to High Sierra. I installed PECL following those instructions and I'd like to install xdebug running pecl install xdebug.
Output
79 source files, building running: phpize grep:
/usr/include/php/main/php.h: No such file or directory grep
/usr/include/php/Zend/zend_modules.h: No such file or directory grep:
/usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for: PHP Api Version: Zend Module Api No: Zend Extension
Api No: building in
/private/tmp/pear/install/pear-build-rootPkeU2l/xdebug-2.6.0 running:
/private/tmp/pear/install/xdebug/configure
--with-php-config=/usr/bin/php-config /private/tmp/pear/install/xdebug/xdebug.c:25:10: fatal error: 'php.h'
file not found
include "php.h"
1 error generated. make: *** [xdebug.lo] Error 1 ERROR: `make' failed
Question
I feel I might did something wrong during the installation of PECL ...
What should I do ?
FIY
php -v
PHP 7.1.16 (cli) (built: Mar 31 2018 02:59:59) ( NTS ) Copyright (c)
1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018
Zend Technologies

Need to run this
xcode-select --install

Related

Unable to install Xdebug after upgrading PHP

I have recently upgraded my Mac to run PHP 8. I noticed Xdebug was no longer installed, so I tried to install it again but I get the following error:
% pecl install xdebug
/usr/local/bin/pecl: line 28: /usr/local/Cellar/php#8.0/8.0.15/bin/php: No such file or directory
/usr/local/bin/pecl: line 28: exec: /usr/local/Cellar/php#8.0/8.0.15/bin/php: cannot execute: No such file or directory
I tried the wizard at https://xdebug.org/wizard, but I can't get phpize installed.
My Mac is running Montery 12.0.1, any idea how I can fix this?
I had the same error message, I resolved it by reinstalling PHP 8.0 with homebrew as explained in this answer:
brew install php#8.0
Be careful that homebrew with also try to update all dependencies and other packages.
Then pecl worked again and I could install xdebug.
[22:39:40] coil#mac-mini.home:/Users/coil/Sites/strangebuzz.com$ php -v
PHP 8.0.19 (cli) (built: May 12 2022 09:09:32) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.19, Copyright (c) Zend Technologies
with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans
with Zend OPcache v8.0.19, Copyright (c), by Zend Technologies

sudo pecl install mongodb problem | unknown type name 'pcre_cache_entry'

I'm trying to install mongodb exentsion for php 8.0.13 on my MacOS Monterey.
I try sudo pecl install mongodb command: and then get below errror.
/opt/homebrew/Cellar/php#8.0/8.0.13/include/php/ext/spl/spl_iterators.h:151:4: error: unknown type name 'pcre_cache_entry'
pcre_cache_entry *pce;
^
1 error generated.
make: *** [php_phongo.lo] Error 1
ERROR: `make' failed
which php: /opt/homebrew/bin/php
php -v: PHP 8.0.13 (cli) (built: Nov 28 2021 13:11:14) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.13, Copyright (c) Zend Technologies with Zend OPcache v8.0.13, Copyright (c), by Zend Technologies
Can anyone help me for fix this error?
Thanks for your attention!
To compile MongoDB using PECL you will have to copy the pcre2.h to php's include directory.
For php#8.0, you can do this, But you will have to do this after every PHP release or if you switch the PHP version.
pcre2_h="$(find "$(brew --cellar pcre2)" -name "pcre2.h")"
cp -f "$pcre2_h" "$(brew --cellar php#8.0)"/*/include/php/ext/pcre
To avoid this I would recommend using shivammathur/extensions brew tap for installing PHP extensions.

Fatal error: Uncaught Error: Class 'ZipArchive' not found

I have this error.
(I don't use Apache just run php script by CLI)
Fatal error: Uncaught Error: Class 'ZipArchive' not found
However it looks that zip module is installed.
$php -m | grep zip
zip
I have installed php by homebrew on Catalina.
php -v
PHP 7.4.10 (cli) (built: Sep 3 2020 18:21:42) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.10, Copyright (c), by Zend Technologies
Is there anything I need to check??
For the ZipArchive class to be present, PHP needs to have the zip extension installed.
See this page for installation instructions (both Linux and Windows).
You need to install Zip extension. Depending where you are working on, it is fairly simple to install it.
cPanel:
Head on to 'PHP PEAR Packages' under the Software tab and search Zip and you'll find ZipArchive. You might also need to activate it manually. Head on to Software > Select PHP Version > Extensions, then check the box for Zip.
For EC2 or any other linux hostings/servers:
sudo apt-get install php7.2-zip

PHPUnit code coverage "No code coverage driver is available", PECL fails

I am trying to generate PHPUnit's code coverage report but get this error: No code coverage driver is available
I am on Mac and when I run php -v at the terminal I get this:
PHP 7.3.11 (cli) (built: Jul 5 2020 03:23:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
This SO answer told me to install XDebug with Homebrew, but that fails as Homebrew can't find a matching formula (for my version of php).
This answer on SO told me to install/activate XDebug or zend-debugger. To install XDebug, their website tells me to run pecl install xdebug, which has the error ERROR: failed to mkdir /usr/lib/php/pear/docs/xdebug/contrib (same error if I do sudo pecl install xdebug). If I try and create the folder manually, I get the error mkdir: pear: Operation not permitted.
Any help is appreciated.

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