![]() ![]() Xdebug from the command line inside a (Vagrant) virtual machine If you have debug mode turned on in Netbeans then the PHP script will hold until you step further in Netbeans. Execute the following in your terminal:Įxport PHP_IDE_CONFIG="serverName=example.local" It’s also possible to debug your PHP console scripts on the command line. Step by step debugging should be working when the correct path mapping is set. It also helps to take a look again at /tmp/php5-xdebug.log on your virtual machine to see on which path the PHP file is that Xdebug opens, caused by the call in your browser. And set the correct path mapping, I set the following: Set Debug URL to “Do Not Open Web Browser”. Click the right mouse button on your project in Netbeans and choose Properties -> Run Configuration -> Advanced. Path mappingĪt this moment almost everything works, but step by step debugging probably still fails. Just close Netbeans and start it again and it should listen to port 9000 again when you click on the debug button. You can check with the following command on your host machine if something is listening on port 9000: ![]() Sometimes if you enable/disable debugging in Netbeans a few times and you enable debugging again, Netbeans says it’s listening but it just isn’t. Give it a tryĬlick on the debug button in Netbeans or press Ctrl + F5 to start the Netbeans debugger and start listening on port 9000.Ĭheck on your virtual machine /tmp/php5-xdebug.log if the xdebug could connect the host machine on port 9000. Restart your webserver or php5-fpm, check with phpinfo() if your configuration is really changed. So xdebug can reach my IDE on my host machine with the IP 192.168.33.1. Vagrant gave my host machine the IP 192.168.33.1. The Vagrant box runs on the IP 192.168.33.10. With a local VM remote_connect_back should work also. xdebug.remote_connect_back=1 Use remote_host or remote_connect_back. Let’s make it work! Add the following settings to xdebug.ini: The Netbeans debugger listens on port 9000 by default, and Xdebug connects to that. In my browser I open the following URL which will point to the virtual machine: īy opening the URL, the web server on the VM creates a connection with Xdebug to my IDE on my host machine. In my /etc/hosts file on my host machine I added the following line to point that example.local to the IP of my virtual machine / Vagrant box (The Vagrantfile contains config.vm.network :hostonly, “192.168.33.10″): A lot of this tutorial works almost the same for PhpStorm.īut getting Xdebug remote to work if your website runs on a virtual machine / Vagrant box, it’s a bit trickier and requires a bit more configuration.įirst let me explain how the Xdebug flow works. Because after installation of Xdebug, it just works. For most people it’s easy to install Xdebug and start debugging their web application on localhost with some IDE, for example Netbeans. It makes step by step debugging possible in your IDE.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |