Here I use Netbeans, xdebug to debug the PHP in the terminal of Ubuntu.
1. you have to install the xdebug extension, pls refer to: [Ubuntu] Easy PHP Debugging in Ubuntu (using Xdebug and Vim)
2. Edit your profile and add this to your envirement.
add these code to it.
reload the profile
Then you can debug the code in Netbeans!
Have fun with Ubuntu!