Phpstorm does not see xdebug but it is installed

前端 未结 5 793
甜味超标
甜味超标 2021-02-04 09:51

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

The error:

Connection with \'xdebug\' was n

相关标签:
5条回答
  • 2021-02-04 10:22

    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

    0 讨论(0)
  • 2021-02-04 10:23

    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.

    0 讨论(0)
  • 2021-02-04 10:34

    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.

    0 讨论(0)
  • 2021-02-04 10:35

    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.

    0 讨论(0)
  • 2021-02-04 10:37

    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 ?

    0 讨论(0)
提交回复
热议问题