Debugging php-cli scripts with xdebug and netbeans?

前端 未结 7 995
闹比i
闹比i 2021-01-29 19:40

I have managed to initiate php-cli script debug session from the IDE itself, but I need to start the debugging session from the shell / command line. These are rather complex ma

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-29 20:24

    I had the same problem, my solution was this:

    1. Environment: Netbeans 8.2 under windows (apache+php)
    2. Assuming you already have PHP and NetBeans configured to debug code using Xdebug (http://wiki.netbeans.org/HowToConfigureXDebug#Notes_on_Windows_Configuration)
    3. On netbeans create new Configuration (“Project Properties” > “Run configuration” > “New…”
    4. In the new Configuration set Do Not Open web Browser (“Advanced” > “Do Not Open web Browser”)
    5. Set active the new configuration created (drop down in tool bar)
    6. Set breakpoint for debug
    7. Open debug (CTRL+F5)
    8. Open Terminal window (“Tools” > “Open in Terminal”)
    9. Type in terminal: $ export XDEBUG_CONFIG="idekey=netbeans-xdebug" (the value "netbeans-xdebug" must coincide with “Tools” > “Options” > “Debugging” > “Session ID”)
    10. Type in terminal: $ php.exe -f "C:\Apache24\htdocs\www.SiteName\ScriptName.php" -- "Arg1=x&Arg2=y"
    11. Follow debug…

提交回复
热议问题