Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
vms:webdev:phpfarm:xdebug [2016/11/29 23:58]
admin [Install Package php-debug (0.2.4)]
vms:webdev:phpfarm:xdebug [2016/11/30 01:46]
admin [Setting up Xdebug’s remote debug with Atom (1.12.5)]
Line 166: Line 166:
  
 ---- ----
-===== Setting up Xdebug’s remote debug with InteeliJ ​IDEA (14.1.1) =====+===== Setting up Xdebug’s remote debug with IntelliJ ​IDEA (14.1.1) =====
  
 === PHP Remote Interpreter plugin: === === PHP Remote Interpreter plugin: ===
Line 203: Line 203:
   * php-debug should appear on top of the list, click the "​Install"​ button   * php-debug should appear on top of the list, click the "​Install"​ button
   * Read the README that is displayed   * Read the README that is displayed
 +
 +For php-debug to be able to give accurate feedback in Atom, you'll need to set the **Path Maps** in the php-debug settings.\\
 +Note that you only need to specify the mapping from your server'​s root directory to your corresponding local root, the projects sub directory can be inferred from this information.
  
 === Configure Xdebug === === Configure Xdebug ===
Line 221: Line 224:
 xdebug.remote_handler=dbgp xdebug.remote_handler=dbgp
 xdebug.remote_mode=req xdebug.remote_mode=req
-xdebug.remote_host=172.20.20.2+xdebug.remote_host=172.20.20.1
 xdebug.remote_port=9000 xdebug.remote_port=9000
 xdebug.idekey=xdebug.atom xdebug.idekey=xdebug.atom
-xdebug.remote_autostart=true;+xdebug.remote_autostart=true
 xdebug.collect_params=4 xdebug.collect_params=4
 xdebug.collect_vars=on xdebug.collect_vars=on
Line 234: Line 237:
 To make sure those values have been taken into account, load the phpinfo page created earlier and check the //​**xdebug**//​ section to make sure the displayed values are in concordance with the ones you've introduced in the ''​php.ini''​ file. To make sure those values have been taken into account, load the phpinfo page created earlier and check the //​**xdebug**//​ section to make sure the displayed values are in concordance with the ones you've introduced in the ''​php.ini''​ file.
  
-With these settings, PHP will **connect to your editor for every script it executes**. The alternative is to use ''​xdebug.remote_autostart=false'',​ and install an Xdebug helper extension for your browser of choice, such as:+=== Remote IP Address === 
 +The ''​xdebug.remote_host''​ IP address should be your workstation'​s IP. In this example we are using a virtualbox VM as development server. In this case, to find out what IP address to use, issue the ''​ip a''​ command from your workstation'​s command line and look for the ''​inet''​ value of the ''​vboxnet0:''​ interface. 
 + 
 +In case you're using Xdebug > 2.1 and your workstation'​s IP address can vary, you could try to use ''​xdebug.remote_connect_back=true''​ instead of the ''​xdebug.remote_host''​ value. In this case, Xdebug will try to use the $_SERVER['​HTTP_X_FORWARDED_FOR'​] and $_SERVER['​REMOTE_ADDR'​] variables to find out which IP address to use. In this case you should **not** set the ''​xdebug.remote_host''​ parameter in your php.ini. 
 + 
 +=== Xdebug autostart === 
 +With ''​xdebug.remote_autostart=true''​, PHP will **connect to your editor for every script it executes**, which brings quite an overhead to all your PHP executions on the server. The alternative is to use ''​xdebug.remote_autostart=false'',​ and install an Xdebug helper extension for your browser of choice, such as:
   * [[https://​addons.mozilla.org/​en-US/​firefox/​addon/​the-easiest-xdebug/​|The easiest Xdebug for Mozilla Firefox]]   * [[https://​addons.mozilla.org/​en-US/​firefox/​addon/​the-easiest-xdebug/​|The easiest Xdebug for Mozilla Firefox]]
   * [[https://​chrome.google.com/​webstore/​detail/​xdebug-helper|Xdebug Helper for Google Chrome]]   * [[https://​chrome.google.com/​webstore/​detail/​xdebug-helper|Xdebug Helper for Google Chrome]]
  
-These browser extensions will give you a button within your browser to enable/​disable Xdebug.+These browser extensions will give you a button within your browser to enable/​disable Xdebug.\\ 
 +In case you notice, in the xdebug table of the phpinfo page, that the **IDE Key** value (right under the version number) **is different from the xdebug.idekey** value set in the php.ini file, verify the parameters of your browser'​s xdebug extension. 
 + 
 +=== All Xdebug settings === 
 +You can learn more about all possible Xdebug settings in the [[https://​xdebug.org/​docs/​all_settings|Xdebug documentation]].