PHP Console in Your Browser

So-called interactive modes for scripting languages are commonly used in the command line, and they are great for quick tests, but most of the time when I try something it tends to grow and quickly becomes painful to handle in a CLI one-liner.

Since I spend most of my days programming PHP I tend to need that a lot and a few years back I wrote a small script that would let me type php code in my browser and execute it. Nothing fancy, but quite useful.

Over the years a few people got interest seeing me use it and asked for the sources, so instead of repackaging it every time, I thought I'd clean it up, polish a bit, add some features, and put it on github.

I can't really let you try it on my website for the obvious security implications, but you can look at the screenshot below or to get your hands on it more directly head to github (seldaek/php-console) or grab the zip archive.

Setup is easy, just put it somewhere, and run it in a browser. It only works from localhost, so it's as secure as your machine is, and I can't be held responsible for anything.

It fetches the execution result with javascript so you can even die() in the script with no problem, and expands tabs to spaces. Press ctrl-enter to submit from the textarea.

What do you think?

September 23, 2010 // PHP

Post a comment

Subscribe to this RSS Feed Comments

2010-09-23 16:50:03


This is friggin' awesome!!! Thanks!

2010-09-24 13:00:03


Good idea! I will use it... thanks

2010-09-24 14:43:50


Frigging great! You could improve it with codemirror, that'd be totally awesome:

2010-09-24 15:18:08


Thanks -- forked!

2010-09-25 08:40:07


@raveren: Thanks for the hint, I'll have a look, but it might mess with my tab expansion code and I'd rather have that than syntax highlighting for small bits of code, so we will see how it turns out.

2010-10-16 21:14:51

Kaloyan K. Tsvetkov

Hi Jordi,

I am the developer of Krumo, and I really like what's you've done with it ;) I am really sorry that I do not have time for it and pretty much the Krumo development has frozen since late 2007. Anyway, cool projects like your make me happy that Krumo is indeed helpful, and not just a funky lib :P

2010-10-19 06:24:07

Silvan Mühlemann

Great tool, Jordi, Thanks. Finally don't need the bash based "php -r 'echo foo();'" stuff...

2010-10-19 16:02:01


@Silvan: Especially since that quickly turns into an escaping hell with $'s and single/double quotes. @Kaloyan: Glad you like it, and thanks for the lib, it's simple and old but it does what it needs to do imo, and that's what matters.

2011-08-10 03:34:50


Just discovered this... Very cool!

2013-05-25 15:20:21


Thank You :)

2013-05-29 17:44:13

Syed Afzal Hussain

This is very nice and simple. Thanks :)

2013-10-06 18:38:18


This is super work Jordi, thanks for putting it up here!

2014-05-30 18:09:22


This is great - exactly what I was looking for. I've been using online ones but it's nicer to have it on my own server as I know what I enter and test is private. Thank you! :)

2015-06-19 19:20:08


Beautiful. Maybe should exist an option to save and load the code?

2015-07-28 14:19:39


I'm confused about enforcing line breaks. Not working for me. Any hints? Also, seems on Windoze you need to install composer (I'm using Xampp and needed to edit my php.ini first), and then run "composer install." Maybe update the README to make that explicit. Just cloning the repo wasn't sufficient. Thanks for the great tool.

2015-07-28 14:22:42


Well, for appropriate HTML output, I guess using print/echo "<br>" works fine.