PHP debugging on OS X - hopeless?

后端 未结 9 494
别跟我提以往
别跟我提以往 2021-01-30 09:35

I have tried:

  1. Xdebug and Eclipse. Eclipse launches a web browser, but the browser tries to access a non-existent file in Eclipse\'s .app bundle.
  2. Xdebug an
相关标签:
9条回答
  • 2021-01-30 10:02

    If you are using MAMP, please note that it has 2 php.ini files that need to be updated. It took me hours to figure this one out. The two files are in the following folders for MAMP 4,

    /Applications/MAMP/bin/php/php5.6.25/conf/php.ini
    /Applications/MAMP/conf/php5.6.25/php.ini
    

    if you're using php7 then you'll need to update those files instead. Scroll to the bottom of the files and make sure you have the following entries,

    [xdebug]
    zend_extension="/Applications/MAMP/bin/php/php5.6.25/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"
    xdebug.default_enable=1
    xdebug.remote_enable=1
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    xdebug.remote_autostart=1
    

    Then make sure you restart your server else the new settings won't be loaded. To make sure Xdebug is working properly, open your MAMP Start page, and click onthe phpinfo tab. Search for xdebug in the listing, you should see the Xdebug section that shows that the extension is loaded and enabled, else something is wrong with the above configurations.

    Next you can launch MacGDBp and it will connect to port 9000 and allow you to debug your files.

    NOTE: If you are developing on Wordpress, then make sure you skip the 'AJAX' debugging sessions. These are regular as the Dashboard will ping the server for changes. If you enable the 'break on the first line' in MacGDBp settings, you will see the ajax sessions breaking on the line define ('DOING_AJAX').... which you can skip. Once you have then fire your event for debugging your code.

    0 讨论(0)
  • 2021-01-30 10:04

    I guess I don't get bonus points, but Zend Studio works for me on my Mac connecting to Apache running in VMware.

    0 讨论(0)
  • 2021-01-30 10:08

    I debug PHP CLI scripts and web probject (thru apache etc) using Eclipse & ZendDebugger all the time.

    I answered a similar question over at the following link: click here

    Hopefully that's what you're looking for.

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