I have trying to get this done for days...and reading through about 20 tutorials, documents, etc...but still no luck.
Here is the thing. I installed wordpress(just for example, can be any php program) on my VPS, and hoping to debug it from my macbook and my desktop. This is clearly a remote debugging thing. So I here is what I done:
1.Installed right version of xdebug and located its .so file on VPS.
2.Changing php.ini and 20-xdebug.ini file on VPS, my settings currently are:
zend_extension=/usr/lib/php5/20131226/xdebug.so
xdebug.remote_enable=1
xdebug.remote_connect_back=1
xdebug.remote_port=9200
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0
xdebug.remote_log=/var/log/xdebug.log
;xdebug.remote_host=202.84.93.66
The last line, which is comment out is my desktop IP address, where I run phpStorm. Based on xdebug's documents, if you set remote_connect_back=1, you won't need this host ip to be specifici.
On phpStorm Side, I "start new project from existing code, and specificy the source root on VPS, map it with one of my local dest. PhpStorm just downloaded all the files and after setting up "Automatic upload", the sync is perfect.
On phpStorm side, I specificy the PHP intercepter as the remote one on my VPS.
On phpStorm side, I changed my debugging port to 9200, as same as the one I using on VPS.
Using the booklet method phpStorm provide, I put them on my firefox bootkmarklet.
Click listen button on phpStorm, set breakpoint, go to firefox open the page, click 'start debuging', refresh.....BUT NOTHING HAPPENS!
I also tried to using the tranditional methods, which set a run configration way as both php-webapplication or php-remote-debug...but still not working.
At php storm, the web debug validation, I could pass all the testing there though....
Can anyone help me with this? I think I must be doing wrong on some very fundation part since I saw all the tutorial are so simple set, but this already took me about 3 days to figure out....
Thanks!
Related
I can't seem to use xdebug in PHPStorm when running a local server. The server document root is the direct parent of the PHPStorm project root and I can run the project on a web browser and through the "Tools | Test RESTful Web Server" option.
I:
am running my Apache server on a mac (OSX 10.10.5) and used brew to install php 5.5 and xdebug 2.3.3 (which was honestly a huge hassle, as nothing wanted to work). The xdebug shows up properly in my phpinfo() and when I use the terminal command $ php -i so I think it is installed correctly.
have followed several guides, tutorials, and SO questions that either do not pertain to my situation and/or their answers were non-working or absent
Configuring Xdebug (PHPStorm) and may more from the PHPStorm website...
Connection Between PHP and Xdebug (SO) this one was the closest I could find to my situation and it did not resolve my issue either. All the other ones I could find were not very helpful because they were working with the MAMP stack.
can't validate my xdebug with PHPStorm in "Run | Web Server Debug Validation". Everytime I try, no matter how I fiddle with the settings, it is either a connection refused error (which I believe is because I am trying unopened ports) or this:
Web Server Debug Validation returns unexpected format error.
Both the bookmarklets that XDebugger supplies on their website and the browser extensions fail as well.
The weird thing to me is, if I create a virtual host in the apache httpd.conf with the servername as my external IP address and with the same document root, I can access it (not the weird part) but I can also run the debugger perfectly fine through it. This is undesirable as it seems that anyone can now run my code and receive responses with sensitive information. They might also be able to start my debugger, but that would be more of an annoyance if they could.
I have been able to, up until this point, work without a debugger, but there have been instances where it would have been great to have one. Looking toward the future I can say for certain that having a debugger will help immensely with my projects, so any help would be greatly appreciated.
I would also prefer not to reinstall everything as it was a huge pain to set it all up in the first place, but if it's a last resort I may have to.
I can provide more information if needed.
Thanks,
Jacob
I managed to get the step debugging to work with a couple changes:
For the validation test, instead of just localhost I attempted to validate a sub-folder that contains my code for the project. The PHPStorm project itself was set to this folder. I think that because my document root was outside of the project that it refused to validate the xdebug extension.
I also configured my DBGp Proxy under Tools to accept the IDE key that xdebug had set as default and updated the IDE key in the xdebug bookmarks.
I can now step debug with Run > Start Listening for PHP Debug Connections and in-browser using the XDebug Debugger bookmarks.
Jacob
In addition to the accepted answer, you need to download and run the debug proxy on the server itself
Download an install the Python Remote Debugging package from Komodo (http://code.activestate.com/komodo/remotedebugging/)
Start the DBGp proxy on the web server.
In PHPStorm, start listening for the debugger: "Run | Start Listening for PHP Debug Connections" (You may need to register the debug server: "Tools | DBGp Proxy | Register IDE")
Jet Brains how-to: https://confluence.jetbrains.com/display/PhpStorm/Multi-user+debugging+in+PhpStorm+with+Xdebug+and+DBGp+proxy#Multi-userdebugginginPhpStormwithXdebugandDBGpproxy-2.DBGpproxy
None of the suggestions worked for me, so I kept digging.
Even though IPV6 was disabled on my network adapter, it is still a preference on the loopback adapter.
A ping localhost would result in Reply from ::1: time<1ms
I've fixed this by preferring IPV4 over IPV6 in the Windows registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\TCPIP6\Parameters
Set DisabledComponents to Hex 0x20 or decimal 32.
Now ping localhost comes back as Reply from 127.0.0.1: bytes=32 time<1ms TTL=128 and the debugger validation works fine.
I've seen other questions/answer about this topic but none of them seem to have the same issue I have, so here we go:
What I'm trying
I'm using phpStorm 8 to develop PHP websites (CakePHP 2.5.1 in this specific case). I have a copy of the website on my computer, make whatever changes there and upload the new version to the production server via the integrated FTP tool. So far all pretty simple, no issues at all.
Now I would like to start using Xdebug to debug the websites using the production server (PHP 5.3.28), so I'm trying to set up remote debugging with phpStorm and Xdebug.
What I have done so far
I have installed Xdebug 2.1.3 on the production server, and it seems to be working. To test that I've done whats recommended in this other SO question, and all those things work.
This is how the config in php.ini looks like:
zend_extension="/usr/local/src/xdebug-2.1.0/modules/xdebug.so"
xdebug.profiler_enable='0'
xdebug.profiler_enable_trigger='1'
xdebug.profiler_output_dir='/home/username/debug'
xdebug.remote_enable='1'
xdebug.remote_connect_back ='1'
I'm not setting the remote_port variable because I'm fine with the default port (9000). Also, I'm not setting the remote_host IP because I'm using the remote_connect_back option to allow multiple IPs, as explained here.
I've also tried 2 different approaches to set all this up:
I followed this Zero Configuration tutorial, but at step 7 I never get the Incoming Connection dialog.
I also followed this different tutorial but in the Integrating XDebug with PhpStorm step I don't have the choose XDebug from the Debugger drop-down list option on step 3
What I need
If someone could help me figure out what I'm missing or doing wrong that would be great!
I would have added this to the comments, but don't have the needed rep.
Have you set the preferences correctly in your project? Were you able to configure and validate your deployment server (under Deployment)?
After that, set up the server under PHP > Server and validate it as well.
Don't forget to check the firewall on your host.
Make sure that you can get XDebug working without PHPStorm, then circle back around and integrate it.
These are the php.ini settings, other than the driver path, that I am using for my CLI project:
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_autostart = 1
xdebug.remote_host = 192.168.100.1
Most importantly, listen to LazyOne. Specify your remote host. And don't run debuggers on your production gear. Spend some time learning about Virtual Machines. My recommendation is to check out VirtualBox, Vagrant, and SaltStack. Used together, these tools will allow you to debug your code in an environment that is as close to production as possible without adding the burdens and risks involved with your debugging tools.
I have been trying to set up debugging using XDebug in Eclipse for the last few hours without success.
I have the following in my etc/php5/apache2/php.ini file
[XDebug]
xdebug.remote_enable=on
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_autostart=off
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
The zend_extensions = /usr/lib...... was given to me by the custom installation instructions on the XDebug site. I followed the setup instructions exactly as they are on that page - http://xdebug.org/wizard.php
But from what I have read typing the command php -m should show XDebug twice, once under PHP modules and once under Zend modules. Well it is showing up under neither for me. So it seems that XDebug is not getting loaded at all?
Anyone any ideas on how to fix this problem and get XDebug working?
You've editted /etc/php5/apache2/php.ini file which is for apache. You'd want to edit /etc/php5/cli/php.ini for the command line interface's options.
If you pass in the phpinfo() from a web site, that PHP has run through Apache of course. And then the wizard will give you settings for the Apache set-up. If you would have passed the phpinfo() output (php -i) from the command line, it would have given you the settings for the CLI.
Something similar happened to me, the first time I setup xdebug in Eclipse it worked just fine, but the next time I tried it, it wasn't stopping at breakpoints. After a lot of research it turned out that I had 2 Eclipse instances running (one for Java and another for Php) and that caused some kind of issues with the debugger.
After closing both instances and starting Eclipse with php workspace first and then Eclipse with java workspace, xdebug worked fine again. My only idea is that debug port was already used when I tried to use it; or something like that.
An other common problem is that you use a router to get through INTERNET and that you had to forward XDEBUG PORT (generaly 9000) on your PC to make XDEBUG working with ECLIPSE.
But your router gives a dynamic IP to your PC and one day your mobile phone connects to the router before your PC and gets the IP address you configuredon you router IP FORWARDING !
The solution getting a static IP from your router. Here is an explanation: http://webologix.com/fr/blog/xdebug-eclipse-fonctionnement-aleatoire.html
I have my 1and1 hosted web site. I've got server-side php I need to debug.
All I've found mentions running/installing xdebug when you have a local web server
with php and mysql on a local web server.
However, I'm using the remote web server hosted at 1and1 hosting.
I'm using and loving netbeans, wow great IDE.
Anyways, how (if it's even possible) can I install then use the xdebug
debugger to debug my php code running at 1and1 from within Netbeans?
I'm wondering if it is my hosting company (1and1) that has to have xdebug installed.
I'm running the latest version of Netbeans but when I press the debug button on
the toolbar I see an error message popup that says
"There is no connection from xdebug detected within 40 seconds. The reasons could be that xdebug is neither installed nor properly configured. Be sure that your php.ini file contains these entries:
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost (or hostname)
xdebug.remote_port=9000
So I searched my harddisk, and despite having installed the full Netbeans
IDE, I have no php.ini file.
So can I make xdebug work remotely, ie. can I debug my php code as it runs on the
remote 1and1 web server, using Netbeans and xdebug?
I've only been using Netbeans for 2 days and for all I know, xdebug is not even a part
of Netbeans. Reason I say that is, I can 'run' my php remotely just fine -- it executes on the remote 1and1 web server when I push 'run' inside Netbeans -- and then the client side output on my local machine is correct. But I cannot step into the code with xdebug by pressing the 'Debug' button on the Netbeans toolbar -- is it possible xdebug did not get installed correctly with Netbeans?
xdebug should be installed inside the php folder and of course the php folder is located on the server where php is installed... at your hosting provider.
I would not expect an hosting provider to install xDebug as it seems to me it would be a huge security hole.
xDebug is not part of Netbeans and it is not part of PHP by default.
Now, looking at things on a more positive viewpoint, if you are going to develop PHP, you NEED a local server. It's very unprofessional to develop code directly on the live server.
Grab a copy of xampp and install it on your computer. Grab a copy of xdebug and install it following the instructions. Restart Apache. There, now you have a testing server.
Once you have a complete set-up on your computer, copy your PHP application's folder inside the "htdoc" folder.
NOW, and only now, should you consider developing in PHP. Develop locally, on your own testing server, xdebug will work whenever you start a debugging session from inside Netbeans.
When everything works, upload your files on your hosted space.
I've using Netbeans to develop on a windows machine, the files I'm editing are on a remote LAMP server. The document root is mounted on my windows machine as a drive letter (Y:). So, netbeans things I'm developing locally, whereas I'm actually developing remotely on a local mount.
My problem starts when I want to use xdebug and netbeans to debug CLI PHP scripts. Debugging browser based stuff is fairly straight forward, but debugging CLI stuff is a little more convoluted and I'm not sure I know how to get it working.
The first problem is that, Netbeans wants to know where the php5 interpreter is, but I can't tell it as it's on the remote server...
Does anyone have any experience with doing this?
Thanks,
Mike
The key Netbeans PHP debugging breakthrough came for me when I added a path mapping to my project (under Project Tab|Right-click Project|Properties|Run Configuration|Advanced Button), so that my project knew how to correlate server source code paths to the local paths (windows drive letter paths).
Example path map:
/home/myusername/sourcedir mapped to x:\sourcedir
I believe I work with a similar configuration to yours (LAMP server, windows machine with the source from the LAMP machine showing up locally under a windows mapped drive). This worked for me.
I had been trying the URLs for my project (http://server/projectroot) as the path mapping. That was not what was needed. The actual path on the server (i.e. my home directory and below) was needed.
Pada meant: xdebug.remote_connect_back, not xdebug.remote_enable. You must have both of them set in order for Xdebug to auto-connect back to Netbeans (or whatever the debugger).
The xdebug.remote_host variable refers to the host that xdebug should connect. You can debug PHP on a remote server using NetBeans, but it would require you to configure xdebug on the remote server such that it would connect to your development PC.
Here's a simple example:
Your development PC, with NetBeans, is on 10.0.0.100,
and your remote PHP webserver is on 10.0.0.1
Set the xdebug.remote_host=10.0.0.100
Now whenever someone (or you) specified the XDEBUG_SESSION_START parameter in the URL on the remote server, xdebug would try to connect to 10.0.0.100.
Xdebug v2.1 has a nice feature: xdebug.remote_enable = 1
Enabling that option would override xdebug.remote_host and then xdebug would connect to the $_SERVER['REMOTE_ADDR'] (which is the IP address that the client is connecting from). This awesome feature would allow you to have multiple debugging on the same server, since you can't manipulate xdebug.remote_host with ini_set()
I don't know about Netbeans, never used it, but in Eclipse PDT where you can also debug using XDebug there is a distinction between "PHP web page" and "PHP script". For "PHP web page" you choose a web server (that you configured earlier) and not a php interpreter (like you have to do with "PHP script").
Perhaps there's the same thing for Netbeans?
xdebug.remote_autostart=1 to automatic remote connection.
in "Xdebug v2.1 has a nice feature:".