Last active
July 8, 2020 11:26
-
-
Save rsantana74/c23c0d75f628a9f3fc9b7f2520f990c3 to your computer and use it in GitHub Desktop.
xdebug-install-usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zend_extension = "C:\xampp\php\ext\php_xdebug.dll" | |
xdebug.profiler_append = 0 | |
xdebug.profiler_enable = 1 | |
xdebug.profiler_enable_trigger = 0 | |
xdebug.profiler_output_dir = "C:\xampp\tmp" | |
xdebug.profiler_output_name = "cachegrind.out.%t-%s" | |
xdebug.remote_enable = 0 | |
xdebug.remote_handler = "dbgp" | |
xdebug.remote_host = "127.0.0.1" | |
xdebug.trace_output_dir = "C:\xampp\tmp" | |
-------- | |
cat /etc/php.d/xdebug.ini | |
; Enable xdebug extension module | |
zend_extension=/usr/lib64/php/modules/xdebug.so | |
xdebug.remote_enable=1 | |
xdebug.remote_host=192.168.137.1 | |
;xdebug.remote_log=xdebug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install xdebug package | |
---------------------- | |
if your distro don't have the package, google for | |
xdebug rpm [your distro, ex. fc20] | |
install it | |
2. Configure it | |
---------------- | |
/etc/php.d | |
[root@www php.d]# cat xdebug.ini | |
zend_extension=/usr/local/zend/lib/php_extensions/xdebug.so | |
xdebug.remote_enable=1 | |
xdebug.remote_host=192.168.175.1 | |
xdebug.remote_log=xdebug.log | |
service httpd restart | |
3. To accept remote connections | |
------------------------------- | |
eclipse/zend studio preferences | |
PHP | |
Debug: server: select a host (default localhost) | |
set as default | |
edit server and change the debug type | |
server | |
Debug | |
installed debuggers | |
xdebug (click configure button) | |
Accept remote sessiont (JIT): select "any" | |
vscode settings | |
--------------- | |
{ | |
"telemetry.enableTelemetry": false, | |
"git.ignoreMissingGitWarning": true, | |
"launch": { | |
"configurations": [ | |
{ | |
"name": "Listen for XDebug", | |
"type": "php", | |
"request": "launch", | |
"port": 9000, | |
"stopOnEntry": true, // Once working, comment out this line | |
"pathMappings": { | |
// eg your web files in C:\Path\To\Code | |
"/mnt/projects/my-project": "${workspaceFolder}" | |
}, | |
"log": true | |
}, | |
{ | |
"name": "Launch currently open script", | |
"type": "php", | |
"request": "launch", | |
"program": "${file}", | |
"cwd": "${fileDirname}", | |
"port": 9000 | |
} | |
] | |
} | |
} | |
To start debugging | |
------------------ | |
For web apps: | |
option 1: use a tool bar e select "debug" | |
option 2: | |
http://server.local/url.php?XDEBUG_SESSION_START=test1 | |
for console apps: | |
enable it before running the command: | |
export XDEBUG_CONFIG="idekey=xdebug" | |
disabling it: | |
unset XDEBUG_CONFIG | |
Since a script is not going to work (b/c variables should be imported to | |
current session), add these aliases into your ~/.bash_profile: | |
alias debugon='export XDEBUG_CONFIG="idekey=xdebug"' | |
alias debugoff='unset XDEBUG_CONFIG' | |
(exit your session and login again) | |
refs | |
---- | |
chrome toobar: | |
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc | |
http://xdebug.org/docs/remote#browser_session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment