I have a problem to debug php files with Aptana Studio. I don't know is it possible to be done because the way of working is a little bit complicated.
Actually I have my source PHP files into my local Windows machine, also my Aptana studio. The Apache server has been installed on the Ubuntu virtual machine and has as source the files of my local Windows machine.
From the web browser into my local Windows I charge the URL of the virtual machine and I would like to debug from Eclipse/Aptana.
I have to configure Xdebug in Eclipse, but I don't find issues how to do in my case.
Is there someone having the same problem or idea ?
Finaly we found the solution for Eclipse PDT but the same is valid for Aptana just the eclipse configurations are a little bit different.
In order to implements the remote debug you must to install the xdebug packages where the virtual machine is (in our case the Ubuntu virtual machine).
After into the /etc/php/7.0/mods-available/xdebug.ini you must to configure the 2 lines :
xdebug.remote_enable=on
xdebug.remote_host=192.X.XX
where the remote_host is the IP of your local machine containg the eclipse.
Further you must to change the eclipse configuration Windows->Preference->PHP->Debug->Debuggers->Xdebug to put the debug port (same as in xdebug.ini file - default 9000), and set Accept remote session (JIT) to any.
For Aptana change the xdebug configuration by searching where Accept remote session (JIT) is.
Related
I'm trying to make this setup work with no success for debugging. I have this Xdebug configuration in a Vagrant box with PHP 8 but I can't debug with Eclipse PDT... Can anybody help or point to the right direction?
The solution was setup xdebug.clienthost to my Windows Machine local network, where eclipse is installed. So I did vagrant ssh, then edit the 20-xdebug.ini located at
/etc/php(the version you are using)/fpm/conf.d and added the line
xdebug.client_host =192.168.1.49
notice that your xdebug.client_port must be 9003 also
of course this is my ip of my laptop in my local network you have to figure out yours and make it fixed if you are behind a dhcp router.
Then I did a vagrant reload.
Then in Eclipse I setup the xdebug preferences to listen the 9003 port, stop the first line and prompt for remote connection.
And in firefox I installed the xdebug helper and choose "debug" before loading the page.
I spent a few days configuring the Apache NetBeans 12.3 and XAMPP 3.2.4 and PHP and I am not able to make it functional in way, that I will be able to debug the code with a breakpoints working.
I installed first new xampp make sure that is completely new installation.
Restart of pc needed so I did so.
Installed ApacheNetbeans 12.3 IDE
Checked the PHP.ini - first strange point. No [Xdebug] Were stated here.
I created new project in netbeans put phpinfo() inside run the page , page showed , copied the content , put it to setup wizard downloaded the dll , put dll to the certain place where they stated opened the php.ini ...
5.1 In php.ini no Xdebug was stated so at the end of the file I added [XDebug] and stated part of code.
5.2 I set up the port to 9000 (also 9001 in another attempt) and saved the php.ini with new values in.
6. Stopped the Apache, Stopped the mysql , turned off the Xampp , run xampp under admin rights , started the apache ,and started the mysql
7. NetBeans - opened the project, removed the phpinfo();
7.1 Added the lines: echo("Test"); $x = 1; echo("after Test");
7.2 Added breakpoint on $x=1;
Run in debug mode.
No breakpoint were catched. In netbeans there was a still message that stated: "Waiting for connection ..."
I am not sure what is here wrong , but I checked many other topics ( they are older than this one) and no solution worked. Is it still Apache netbeans and Xampp on windows 10 compatible ?
I know I was able to run and use it few years ago when it was not Apache NetBeans but just netbeans and I did not face that issue. Just installed both Xampp and Netbeans and no other special configuration were needed.
I turned off the firewall ,
checked if there is no zend tags in php.ini ,
checked if it installed it shows it is , and it is OK (shows versions) ,
changed ports to 9001 or different as was suggested in another threads ,
tested few different commands like xdebug.enable_remote = on , instead 1 and vice versa ...
after I clicked netbeans help which appears after I stopped debugging the link goes to not found page ...
I googled the wiki page of netbeans and proceed these steps as well ...
Did anyone face the same issue on clean install ? What is the solution for that or what I am doing wrong ?
Thanks so much .
Edit 17.5.2021 .
There is no antivirus installed and also windows firewall and defender is off .
Localhost can be loaded with page but no break points available.
Edit: Adding my log:
Xdebug installed: 3.0.4
Server API: Apache 2.0 Handler
Windows: yes
Compiler: MS VC15
Architecture: x64
Zend Server: no
PHP Version: 7.4.10
Zend API nr: 320190902
PHP API nr: 20190902
Debug Build: no
Thread Safe Build: yes
OPcache Loaded: no
Configuration File Path: no value
Configuration File: C:\xampp\php\php.ini
Extensions directory: C:\xampp\php\ext
NetBeans 12.3 and XAMPP 3.2.4 are compatible with win10.but if you pre installed antivirus software like avast or kaspaskey they will detect xampp as a malicious software.so before you run xampp turn off the antivirus software and try again.
First right click on your my computer icon & choose manage
then go to services and applications
select services
set windows defender startup type to manual instead of Automatic & restart the computer.and try again from installation xampp. you should try from xampp installation
If it does not work install a xampp old version and try again.
Sometimes windows defender detect it as a malicious software. So turn it off and try again.
There is no matter with netbeans ide.
If you getting problems with xampp every time install zend server or another WAMP software and continue work
Could you please advice me how properly configure Xdebug for Laravel application. I found a lot instructions for PhpStorm but they do not work for me as I'm using IntelliJ IDEA Ultimate.
What I have already achieved - I can debug single PHP script but not whole application. I cannot follow completely the instruction which is given for PhpStorm because on step when I need to configure Run/Debug Configuration I got stucked.
Much appreciation on any help in advance!
Okay, I gathered full instruction how to work with XDebug and IntelliJ Idea Ultimate to debug Laravel application and Windows specifically (if you use other OS the installation part will be different but other should be the same):
First of all you need to install XDebug itself and configure PHP to work with it. For that:
Find out which PHP version you use using phpinfo() you will need Version, Architecture and PHP Extension Build sections to complete next step.
Go to https://xdebug.org/download.php and download appropriate build. Basically it is dll provided for specific PHP you have installed
After that copy that DLL to Apache modules directory - for me that is D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\ as I'm using OpenServer.
Put into php.ini file following configuration:
[Xdebug]
zend_extension="D:\OSPanel\modules\http\Apache-PHP-7-x64\modules\php_xdebug-2.6.0-7.1-vc14-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_host = "localhost"
xdebug.remote_autostart=on
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.idekey="PHPSTORM"
where php_xdebug-2.6.0-7.1-vc14-x86_64.dll is name of dll I personally downloaded.
Restart Apache
Open your Laravel project and check your Debuggin configuration (File > Settings... > Languages & Frameworks > PHP > Debug): check XDebug section if Debug port is the same as you specified above (it should be, if you did not changet it previously)
Delete all your Run/Debug configurations
Install Xdebug Helper for Chrome or any other extension if your not using Chrome (Browser Debugging Extensions)
Hit Run > Start listening for PHP Debug Connections
Put break point in your project and open appropriate site context
Enjoy!
Hope that will be useful for community.
I'm on Windows and I'm trying to debug a Web application (hosted with Vagrant/Homestead) using PhpStorm through XDebug. I tried many configurations but I can't get things working. The PhpStorm XDebug setup is pretty common.
This is the current xdebug configuration:
vagrant#homestead: /etc/php/7.0/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable = on
xdebug.remote_connect_back = on
xdebug.idekey='PHPSTORM'
In the IDE "Start listening for PHP debug connections" it's turned on. When I attempt to start debugging a new chrome tab opens and the URL ends, for example, with ?XDEBUG_SESSION_START=16588 but the debugger doesn't run and this is what the IDE says:
Also, netstat says the port 9000 is still listening.
Any idea?
You are changing the 20-xdebug.ini file for the Command Line Interface (CLI). Instead you need to change the /etc/php/7.0/apache2/conf.d/20-xdebug.ini for the Apache settings, since you are using Chrome.
UPDATE
I'm not sure of the differences between Apache and Nginx (which may be /etc/php/7.0/fpm/conf.d/20-xdebug.ini), but here is how I got it working with a VirtualBox VM running Apache, on a Windows computer.
Settings for 20-xdebug.ini:
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.1... (your windows IP address within your network)
xdebug.remote_port=9000
xdebug.autostart=1
I'm trying to use XDebug in the following scenario
Physical Host on Windows 7, with Netbeans 7.1.1
Virtual guest on Ubuntu, with Apache server and PHP 5.3.10
the PHP code of my website is on a shared folder on Ubuntu, in /var/www/mysite
the PHP code is accessible from my Windows host, on \\guestIP\mysite, with R/W permissions
Website accessible from http://mysite.local.fr, from both host and guest
I created a Netbeans project from my Windows Host, pointing to \\guestIP\mysite.
In the project Run configuration, I have the following:
Run as: Local web server
Project URL: http://mysite.local.fr
Index file: index.php (does exist in the project)
In the Advanced Run Configuration:
I checked "Ask every time" (I also tried using "Do not ask" and starting the browser with the session key myself)
I tried setting '/var/www/mysite' - \\GuestIP\mysite for the mapping (and tried using nothing as well)
I haven't touched the proxy settings
I have the following in the php.ini on my Ubuntu VM
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = /tmp
;xdebug.remote_host=localhost,<HostIP>, mysite.local.fr
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.idekey="netbeans-xdebug"
xdebug.remote_mode=req
None of this works, Netbeans does not stop at any breakpoint from Windows.
Debugging directly from my VM with Netbeans works fine.
Can someone tell me how to get my debugger to work remotely from Windows?
Thanks
Sorry, i can't comment anymore. #David #JamesB41: I've been looking for this too. My setup is a Windows 7 host with NetBeans 7.1, and an Ubuntu VM in VirtualBox. I have the NetBeans project set up as a remote project, uploading and downloading using SFTP.
The following setup works for me, just use your host's IP as remote_host, and make sure the VM can see it.
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=10.217.165.193
xdebug.remote_port=9000
xdebug.remote_log="/tmp/log/xdebug.log"
NetBeans will stop at the entry point breakpoint (if you have the option set in PHP->Debugging). But, it won't stop on NetBeans-created breakpoints, because its running off the VM's files. You can use xdebug_break() though, and it will show stack and variables. It will stop at NetBeans breakpoints and highlight if you map the folders correctly in project config > Run Config > Advanced. Awesome. I am complete.
(The connect_back config didn't seem to help, possibly because $_SERVER['REMOTE_ADDR'] isn't populated.)
Go through the below document for remote debugging using NetBeans. Very helpful.
http://stuporglue.org/setting-up-xdebug-with-netbeans-on-windows-with-a-remote-apache-server/
In know this is old but a good reminder. Make sure if you are using nat in virtualbox that you set port forwarding on the xdebug port back to the local machine typically 9000 by default.
Another option is to have the VM configured to speak to its own localhost:9000 (default for xdebug) and then ssh in from host to VM and establish a port tunnel for that port back to the host machine. Then your host machine debugger simply connects to localhost:9000 and everything should work exactly as if they were running on the same machine.
See: Multiple users XDebug and PHP Debugging
Debugging remotely with Linux + Apache + PHP + xdebug + NetBeans (SFTP)
I've got the following setup and it works.
Host PC (client)
Linux Debian Jessie **
NetBeans version 8.0.2
NetBeans has a project created as "PHP Application from Remote
Server", that has to be debugged
NetBeans connects to Remote Server using SFTP
IP (for example): 192.168.0.2
** I am aware that the OP question mentions Windows, but regarding that the main setup to solve this should be made on the VM, I hope this helps somebody anyway.
Guest PC (server) / Virtual Machine
Linux Debian Jessie
Apache
PHP 5.6
xdebug 2.2.5
IP (for example): 192.168.0.1
The following steps should be made on the "Guest PC (server) / Virtual Machine"
install xdebug sudo apt-get install php5-xdebug
edit /etc/php5/apache2/php.ini,
add these lines right before the [Date] AND change xdebug.remote_host to reflect your "Host PC (client)" IP:
[debug]
; Remote settings
xdebug.remote_autostart=off
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=192.168.0.2
xdebug.remote_port=9000
restart apache sudo service apache2 restart
Reference
How to configure XDebug - Remote Debuging http://wiki.netbeans.org/HowToConfigureXDebug#Remote_Debuging
you need to have correctly configured property xdebug_remote.host on
remote machine. The IP address of local machine has to be defined in
this property. For example, you want to debug your source code on
remote machine 192.168.0.1 using Netbeans installed on 192.168.0.2.
You need to change xdebug.remote_host on 192.168.0.1 to
xdebug.remote_host=192.168.0.2. If doesn't work verify you have port
configured in xdebug.remote_port open on both machines.
If all seems to be correct but you still get "Waiting For Connection" from inside netbeans you should try in your php.ini settings
xdebug.remote_connect_back=on
as it allows connection from ANY ip or look at a lot more info on the issue http://www.devside.net/wamp-server/netbeans-waiting-for-connection-netbeans-xdebug-issue