Dee
Dee

Reputation: 91

How to getting Xdebug working for php 7.3 and apache (MACOS)

I'm trying to get Xdebug (I installed 2.7 with pecl) working for php but getting the following error.

php -v
Xdebug requires Zend Engine API version 320160303.
The Zend Engine API version 320180731 which is installed, is newer.
Contact Derick Rethans at http://xdebug.org/docs/faq#api for a later version of Xdebug. 

PHP 7.3.3 (cli) (built: Mar  8 2019 16:40:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.3, Copyright (c) 1999-2018, by Zend Technologies

I've installed the latest version of PHP 7.3 with Homebrew, but Apache is using PHP Version 7.1.23 . I think I'm having an issue because I'm using wrong Zend API version.

php config in httpd.conf is

LoadModule php7_module libexec/apache2/libphp7.so

phpize gives the following.

/usr/local/bin/phpize -v
        Configuring for:
        PHP Api Version:         20180731
        Zend Module Api No:      20180731
        Zend Extension Api No:   320180731

I've added the following to php.ini

zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so

Which exists here :

/usr/lib/php/extensions/no-debug-non-zts-20160303  ls
opcache.a  opcache.so xdebug.so

My questions

Upvotes: 6

Views: 6938

Answers (3)

Thushara Buddhika
Thushara Buddhika

Reputation: 1820

You can use, https://xdebug.org/wizard.php.

For Windows,

  • Open terminal and enter php -i.
  • Copy the result and paste it on the text area.
  • It will say to download a dll file, Download it.
  • Rename downloaded file to php_xdebug.dll and copy to {php-intallation-path}/ext
  • Open php.ini file and,

-> Uncomment these, (remove the leading ; only for the extension_dir),

; On windows:
; extension_dir = "ext"

-> Add following line,

zend_extension = xdebug

Rerun the xdebug wizard to confirm,

Xdebug installed: 3.1.1

Upvotes: 0

Ayoub Benayache
Ayoub Benayache

Reputation: 1164

The xdebug site currently only has 64-bit versions for PHP 7.3; the PECL site has the 32-bit versions needed for XAMPP.

this will be corrected once xdebug 2.7 is production, but in the meanwhile the PECL site is the work around.

Upvotes: 1

Dee
Dee

Reputation: 91

After quite a bit more research I found the following tool.

https://xdebug.org/wizard.php

I followed the instructions with some minor changes required for the path and Xdebug is now working.

Upvotes: 3

Related Questions