1

UPDATED

I am trying to configure xdebug in PhpStorm. I ran phpinfo() and I could see that xdebug version, IDE key and that it is enabled.

Loaded Configuration File : /etc/php/7.0/cli/php.ini 

However in the php.ini file, there is no [xdebug] section But I found 20-xdebug.ini file in the /etc/php/7.0/cli/conf.d folder. (I assume this is the one I should edit for configuration)

It contains only one line: zend_extension=xdebug.so There is no port number, enable/disable.What is the next step in configuring xdebug?

Madhuka Harith
  • 175
  • 1
  • 2
  • 13

2 Answers2

2

Usually, configuration files for all extensions are placed in a directory called conf.d.

Also, have a look at rows contained 'Additional .ini files parsed' or 'Scan this dir for additional .ini files'. You can see below how it looks for my environment (a peace of php -i output):

Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => 
    /usr/local/etc/php/conf.d/docker-php-ext-gd.ini,
    /usr/local/etc/php/conf.d/docker-php-ext-intl.ini,
    /usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini,
    /usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
    /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini,
    /usr/local/etc/php/conf.d/docker-php-ext-zip.ini,
lndim
  • 191
  • 7
  • Hi, yeah it was in the `conf.d` directory. However it only contains one line `zend_extension=xdebug.so ` No port number, How do I enable xdebug – Madhuka Harith Jan 16 '17 at 04:59
  • @MadhukaHarith, just add what you need after a line contained `zend_extension=xdebug.so`. – lndim Jan 16 '17 at 06:20
1

Clue 1. Verify that you don't have two versions of PHP running on your system. Sometimes it happens if you install new PHP with a package manager, over existing one shipped with OS.

Clue 2. Restart "brew services restart php56" or apache2(apachectl start/stop)

The Steps I go through to install xdebug:

A. Install xdebug with package manager brew install homebrew/php/php56-xdebug

B. Check the list of loaded ini-files with php --ini

Console output:

Configuration File (php.ini) Path: /usr/local/etc/php/5.6
Loaded Configuration File:         /usr/local/etc/php/5.6/php.ini
Scan for additional .ini files in: /usr/local/etc/php/5.6/conf.d
Additional .ini files parsed:      /usr/local/etc/php/5.6/conf.d/ext-gmagick.ini,
/usr/local/etc/php/5.6/conf.d/ext-igbinary.ini,
/usr/local/etc/php/5.6/conf.d/ext-imagick.ini,
/usr/local/etc/php/5.6/conf.d/ext-intl.ini,
/usr/local/etc/php/5.6/conf.d/ext-ioncubeloader.ini,
/usr/local/etc/php/5.6/conf.d/ext-mailparse.ini,
/usr/local/etc/php/5.6/conf.d/ext-mcrypt.ini,
/usr/local/etc/php/5.6/conf.d/ext-mongo.ini,
/usr/local/etc/php/5.6/conf.d/ext-oauth.ini,
/usr/local/etc/php/5.6/conf.d/ext-opcache.ini,
/usr/local/etc/php/5.6/conf.d/ext-tidy.ini,
/usr/local/etc/php/5.6/conf.d/ext-uploadprogress.ini,
/usr/local/etc/php/5.6/conf.d/ext-xdebug.ini

C. php -m | grep xdebug - If you have xdebug modules installed, you will see "xdebug" in output.

D. verify "zend_extension=" line that points on xdebug.so. Should be already there if you install with package manager.

E. Check tune settings for xdebug, mine are:

[xdebug] zend_extension="/usr/local/opt/php56-xdebug/xdebug.so"

xdebug.remote_port=9089 // <-- same in IDE
xdebug.default_enable=1
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_handler=dbgp
xdebug.idekey=PHPSTORM
xdebug.var_display_max_depth = -1 
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1 
xdebug.max_nesting_level = 1000

F. In PhpStorm set port number to 9089 and select can accept external connections: "X"

Hope it helps. (I'm using mac, but is the same for Linux or Win)

Ivan Proskuryakov
  • 1,625
  • 2
  • 23
  • 32
  • Hi I found the xdebug.ini file but it only contains this : `zend_extension=xdebug.so ` Should I manually enter the port number and other details to enable xdebug? – Madhuka Harith Jan 16 '17 at 05:02
  • A. How php was installed on your system? B. What os are you using? C. Is it the same xdebug.ini file from "php --ini" output? Yes, you need them, normally the port is 9000. I've had a problem with 9000, so I've "tuned" port on my side. related: http://stackoverflow.com/questions/8049776/xdebug-for-remote-server-not-connecting, https://xdebug.org/docs/remote – Ivan Proskuryakov Jan 16 '17 at 08:10
  • `PHP 7.0.8-0ubuntu0.16.04.3 (cli) ( NTS ) 1997-2016 The PHP Group Zend Engine v3.0.0, 1998-2016 Zend Technologies with Zend OPcache v7.0.8-0ubuntu0.16.04.3, 1999-2016, by Zend Technologies with Xdebug v2.4.0, 2002-2016, by Derick Rethans ` c)Yes – Madhuka Harith Jan 16 '17 at 08:25