PHP debugging on OS X - hopeless?

后端 未结 9 493
别跟我提以往
别跟我提以往 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 09:47

    I use Komodo 5 --- debugging works wonderfully, not only with PHP, but also with Ruby and Python. I mostly use it to debug PHP scripts that are running on a remote server but you can do local stuff as well. It's not free, but assuming your own time is worth something, you will have gotten your money back within a few hours!

    0 讨论(0)
  • 2021-01-30 09:48

    There is a way how to do it using

    • PhpStorm
    • Homebrew
      ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    • Php + Xdebug

    1) Install php and debug

    brew install php70   
    brew install php70-xdebug
    
    • In PhpStorm - check Preferences => Language and Frameworks => PHP
      Php language level: 7
      Interpreter: PHP 7.0.8 + XDebug (or choose from [...])

    • Check debug config: Preferences => Language and Frameworks => PHP => Debug => Xdebug section
      All checkboxes should be checked and set Debug port to: 9001

    2) run server in your app's directory:

    php -S localhost:8080
    

    3) Add localhost:8080 to PhpStorm Preferences => Language and Frameworks => PHP => Servers:
    Name: Localhost:8080
    Host: localhost
    Port: 8080
    Debugger: Xdebug

    4) Update php.ini:
    Php => Interpreter => […] => Configuration file - Open in Editor
    Add this section: (check zend_extention path through the cli)

    [Xdebug]
    zend_extension=/usr/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
    xdebug.remote_enable=1
    xdebug.remote_host=localhost
    xdebug.remote_port=9001 (same as in Debug preferences)
    

    5) Add Debug Configuration: Run => Edit Configuration => add - Php Web Application

    • Choose Localhost:8080 server

    6) Click Start Listening for Php Debug Connections
    7) Set up breakpoints
    7) Click on Debug (Green bug)

    0 讨论(0)
  • 2021-01-30 09:49

    Just wanted to update this thread to let you know there's a new app out here http://codebugapp.com/ it's commercial, but it's Xdebug client for OSX

    0 讨论(0)
  • 2021-01-30 09:58

    Been looking for php debugger for osx myself too. This one looks promising: http://www.turingart.com/phpdebugger_lan__en.htm

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

    Here's how I did it:

    1 - Copy the latest version of xdebug.so from http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging to /usr/libexec.

    2 - Add the following to the global php.ini:

    zend_extension="/usr/libexec/xdebug.so"
    xdebug.remote_enable=1
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    xdebug.remote_autostart=1
    

    3 - Restart Apache and run MacGDBp.

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

    You may want to look into MacGDBp. It's new, free, and the UI looks great. It utilizes the Xdebug PHP extension as well. You can find instructions in the help section, which includes Xdebug configurations, and there's also a nice overview of the app from the guys at Particletree here: Silence The Echo with MacGDBp.

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