Created
March 29, 2020 12:16
-
-
Save AnrDaemon/a356143f306545ca924ef6878363e329 to your computer and use it in GitHub Desktop.
Manual xdebug trigger script
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Panel</title> | |
<link rel="shortcut icon" href="/favicon.png" type="image/png"/> | |
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/> | |
<base target="_blank" /> | |
</head> | |
<body> | |
<h1>Example project</h1> | |
<div style="margin-left: 2em;"> | |
<p><a href="https://project.example.lan/_doc/ui/">Web UI elements reference</a></p> | |
<p><a href="https://project.example.lan/admin/_info">phpinfo();</a></p> | |
<form method="POST" action="https://project.example.lan/login"> | |
<input type="hidden" name="login" value="superadmin"/> | |
<input type="hidden" name="password" value="coolpassword"/> | |
<label><a href="https://project.example.lan/login">Login</a>: | |
<button type="submit">admin</button> | |
</label> | |
</form> | |
<p><a href="https://project.example.lan/xdebug.php?XDEBUG_SESSION=project&XDEBUG_PATH=/base/" target="xdebug">XDebug @project</a></p> | |
</div> | |
<iframe name="xdebug" style="width: 100%; margin: 5px -5px; height: auto; border: none;"></iframe> | |
<p style="position: fixed; bottom: 0.25ex; right: 0.5em;"><a href="/panel.html" target="_top">[reload]</a></p> | |
</body> | |
</html> |
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
<?php | |
header("Content-Type: text/plain;charset=UTF-8"); | |
if(!empty($_REQUEST["XDEBUG_SESSION"])) | |
{ | |
setcookie( | |
'XDEBUG_SESSION', | |
$_REQUEST["XDEBUG_SESSION"] ?? ini_get('xdebug.idekey'), | |
ini_get('xdebug.remote_cookie_expire_time') ? time() + ini_get('xdebug.remote_cookie_expire_time') : 0, | |
$_REQUEST["XDEBUG_PATH"] ?? '/', | |
$_REQUEST["XDEBUG_DOMAIN"] ?? ".{$_SERVER["SERVER_NAME"]}", | |
false, | |
true | |
); | |
} | |
function i($key) | |
{ | |
static $map = [ | |
"xdebug.idekey" => "XDEBUG_SESSION", | |
]; | |
return (isset($map[$key]) ? $_REQUEST[$map[$key]] : ini_get($key)) . "\n"; | |
} | |
?> | |
xdebug.idekey = <?=i("xdebug.idekey")?> | |
xdebug.extended_info = <?=i("xdebug.extended_info")?> | |
xdebug.scream = <?=i("xdebug.scream")?> | |
xdebug.force_display_errors = <?=i("xdebug.force_display_errors")?> | |
xdebug.force_error_reporting = <?=i("xdebug.force_error_reporting")?> | |
xdebug.halt_level = <?=i("xdebug.halt_level")?> | |
xdebug.remote_enable = <?=i("xdebug.remote_enable")?> | |
xdebug.remote_mode = <?=i("xdebug.remote_mode")?> | |
xdebug.remote_timeout = <?=i("xdebug.remote_timeout")?> | |
xdebug.remote_autostart = <?=i("xdebug.remote_autostart")?> | |
xdebug.remote_cookie_expire_time = <?=i('xdebug.remote_cookie_expire_time')?> | |
xdebug.remote_handler = <?=i("xdebug.remote_handler")?> | |
xdebug.remote_host = <?=i("xdebug.remote_host")?> | |
xdebug.remote_port = <?=i("xdebug.remote_port")?> | |
xdebug.remote_log = <?=i("xdebug.remote_log")?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment