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?

2 Answers 2

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,
Sign up to request clarification or add additional context in comments.

2 Comments

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
@MadhukaHarith, just add what you need after a line contained zend_extension=xdebug.so.
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)

3 Comments

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?
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: stackoverflow.com/questions/8049776/…, xdebug.org/docs/remote
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.