PHP Classes

PHP Web Console: Execute PHP commands on a console Web page

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 267 This week: 1All time: 7,741 This week: 560Up
Version License PHP version Categories
php-web-console 1.0Public Domain5.4HTML, PHP 5, Debug, Logging
Description 

Author

This class can Execute PHP commands on a console web page inspired by the Chromium JavaScript console.

It can execute given PHP code and other console commands and stores HTML to display the results on session variables.

The class can output the responses of the requested console commands as response to AJAX requests that update the current page with the commands output for the users to see on the web page.

The other console commands that it supports are log to display an arbitrary message, alert to display a message in an alert dialog on the browser, backtrace to show the function call backtrace.

Picture of Matthew Knowlton
  Performance   Level  
Name: Matthew Knowlton is available for providing paid consulting. Contact Matthew Knowlton .
Classes: 6 packages by
Country: United States United States
Age: 28
All time rank: 2036291 in United States United States
Week rank: 411 Up48 in United States United States Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Example

<?php
require_once('PHPConsole.class.php');

if(isset(
$_POST['command']) && $_POST['command'] != ''){
   
PHPConsole::run($_POST['command']);
    exit();
}
?>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
setTimeout(function(){
    $('#submit').click(function(){
        if($('#command').val() == '') return;
        $.post('console.example1.php',{'command': $('#command').val()},function(r){
            $('#command').val('');
        });
    });
   
    $('#stop').click(function(){
        $.post('console.example1.php',{'command': 'exit();'},function(r){
            $('#command, #submit, #stop').hide();
            $('#restart').show();
           
        });
    });
   
    $('#restart').click(function(){
        top.location.reload();
    });
},1000);
</script>

<div>
    <input id="command" name="command"/>
    <button id="submit">Submit</button>
    <button id="stop">Stop</button>
    <button id="restart" style="display:none;">Start</button>
    <br/>
</div>

<?php
PHPConsole
::printDisplay();
?>


Screenshots  
  • PHPConsole.jpg
  Files folder image Files  
File Role Description
Plain text file PHPConsole.class.php Class PHPConsole Class
Accessible without login Plain text file console.example1.php Example Example of a PHP console setup
Accessible without login Plain text file console.example2.php Example Example of PHPConsole being used for logging by an separate script.

 Version Control Unique User Downloads Download Rankings  
 0%
Total:267
This week:1
All time:7,741
This week:560Up