Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phpstorm does not see xdebug but it is installed

PhpStorm cannot see xdebug but it is installed. In my browser xdebug works fine. Where is the problem?

The error:

Connection with 'xdebug' was not established. Validate installation.

php.ini

[xdebug]
xdebug.idekey=PHPSTORM
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.default_enable=1
xdebug.coverage_enable=1
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_autostart=1

phpinfo in phpstorm:

PHP version: 5.4.10

Loaded extensions:  bcmath, bz2, calendar, Core, ctype, curl, date, dom, ereg, exif, fileinfo, filter, ftp, gd, gettext, hash, iconv, imap, json, ldap, libxml, mbstring, mcrypt, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, Reflection, session, SimpleXML, soap, sockets, SPL, sqlite3, standard, tokenizer, XCache, xml, xmlreader, xmlwriter, xsl, yaz, zip, zlib
like image 210
RDK Avatar asked Apr 26 '13 12:04

RDK


People also ask

Why is Xdebug not working?

Xdebug cannot connect to PhpStorm This means that Xdebug tries to connect to the host and can't make the connection. To fix the issue, set xdebug. remote_connect_back=0 ( xdebug. discover_client_host=false for Xdebug 3) and make sure that xdebug.


3 Answers

First, are you using MAMP (free) or MAMP Pro?

Turns out there is a difference between the php.ini file you edit from MAMP and the php.ini file that PhpStorm uses in the interpreter.

The MAMP Pro php.ini file resides in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini and doesn't have a PHP installation (which PhpStorm needs when setting the interpreter). If you run phpinfo(); this is the file you will see data from.

When you set PhpStorm to the necessary location here /Applications/MAMP/bin/php/php5.4.x/bin it looks at the php.ini file there, not the one that MAMP Pro uses (above). So if you want PhpStorm to see the debugger, you need to add the code to that php.ini file.

PhpStorm Interpreter Settings

For help setting up the interpreter for MAMP and PhpStorm refer to the documentation here

HELPFUL HINT: When checking to see if xdebug is installed make sure to run the --version command in terminal from the MAMP php location. Otherwise you'll end up seeing the default OSX PHP info which wouldn't have xdebug installed by default.

Example: run this in the PhpStorm terminal to see if it works /Applications/Mamp/bin/php/php5.4.4/bin/php --version

like image 91
Ian Avatar answered Oct 18 '22 22:10

Ian


MAMP using different php.ini if you run it from terminal, try this code to find the php.ini

php -i | grep php.ini

After that add the code for activate the xDebug

[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_port=9000
xdebug.profiler_enable=1
xdebug.remote_host=localhost
xdebug.profiler_output_dir="/Applications/MAMP/tmp/xdebug"
xdebug.max_nesting_level=1000

If this work, please consider accept the answer for the benefit the others.

like image 39
GusDeCooL Avatar answered Oct 18 '22 22:10

GusDeCooL


This is because Mac OS X has php installed by default. There are two ini files for MAMP PRO.

PhpStorm will run the default php which you do not add the xdebug function to it.

Read this post for the solution

http://devnet.jetbrains.com/message/5466653

Pay attention to the STEP 5

===================================

okay, if it do not work, I thought u may not pay enough attention to the article, It do helpful and explain the reason, read i again ?

like image 1
Lewison Chen Avatar answered Oct 18 '22 22:10

Lewison Chen