Phpstorm does not see xdebug but it is installed

谁说我不能喝 提交于 2019-12-20 10:43:14

问题


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

回答1:


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.

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




回答2:


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.




回答3:


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 ?




回答4:


I had similar problem.

I did:

  1. Installed xdebug by following the steps here.
  2. Found out which version of PHP does my PHPStorm use.
  3. Created a new entry in the corresponding php.ini file of the /path/to/xdebug/modules/xdebug.so.

and I was able to solve my problem. xdebug is working now.




回答5:


I had a similar issue in that it worked then it did not.

In my case, the cause turned out to be an miss placed .htaccess file in the root of the project.

The .htaccess file (repeated below) was there from a previous set of testing and was intended to stop XDebug from working. It sure did.

php_value xdebug.remote_autostart 0
php_value xdebug.remote_enable 0
php_value xdebug.profiler_enable 0

I just renamed the file and like magic, all was good.



来源:https://stackoverflow.com/questions/16236845/phpstorm-does-not-see-xdebug-but-it-is-installed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!