Add Xdebug to a Chocolatey Installed PHP

This is my version of…

Login

Blog History

This is my version of PHP. installed with choco install php. Notice no Xdebug

php -v
PHP 8.1.6 (cli) (built: May 11 2022 08:56:01) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies

Goto downloads for xdebug here => https://xdebug.org/download

I choose the PHP 8.1 VS16 (64bit) build from the above page as my default install is NTS (Non-Type-Safe)

Copy the php_xdebug-3.1.4-8.1-vs16-nts-x86_64.dll file to the c:\tools\php81\ext directory

Open c:\tools\php81\php.ini and add zend_extension=xdebug-3.1.4-8.1-vs16-nts-x86_64 under the extensions= statements

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

;extension=bz2
extension=curl
;extension=ffi
;extension=ftp
extension=fileinfo
extension=gd
;extension=gettext
;extension=gmp
extension=intl
;extension=imap
;extension=ldap
extension=mbstring
;extension=exif      ; Must be after mbstring as it depends on it
extension=mysqli
;extension=oci8_12c  ; Use with Oracle Database 12c Instant Client
;extension=oci8_19  ; Use with Oracle Database 19 Instant Client
;extension=odbc
extension=openssl
;extension=pdo_firebird
extension=pdo_mysql
;extension=pdo_oci
;extension=pdo_odbc
;extension=pdo_pgsql
extension=pdo_sqlite
;extension=pgsql
;extension=shmop
# add this extension
zend_extension=xdebug-3.1.4-8.1-vs16-nts-x86_64

Check it works using the output of php -v

php -v
PHP 8.1.6 (cli) (built: May 11 2022 08:56:01) (NTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.6, Copyright (c) Zend Technologies
    with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans

3 Comments

  1. Maxime Michaud

    Great articles! Working with PHP 8.3 in 2024 ?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.