Have you ever needed to run some PHP really fast but couldn’t or wouldn’t use the command line? If you have, you can use the Quick PHP Executer.
The PHP Executer is a tiny little PHP script that runs your PHP code. Simply type your code into the textarea and when ready, hit execute and you’ll get your code executed.
Your code is not put into an eval statement. Why? Because, if your code does contain an error, eval will hide where your error is. It’ll simply say error was found in eval’d code. Useless. No, the PHP Executer will do something smarter and rely on the true php interpreter.
The PHP Executer writes a text file with your code wrapped inside of the PHP brackets. Then, it saves the file as a PHP file. After that, you’re redirected to your brand new page of PHP code. It runs and if there are errors, they are true errors that tell you where and what they are.
The PHP Executer offers just a few features, but it’s better than other PHP Executers I’ve seen. Mine offers the following.
- No eval. Pure PHP execution.
- There are two frames so your code and your executed code is always side by side.
- Keeps track of recent (as in current session) executions.
- Files are named from a base 32 sha1 of the code you type. The problem is that it makes the file names really long but guarantees that files are never overwritten.
- Files are purged (to save space and cut clutter) from the system by default every seven days.
- Things are only deleted when you use the executer but not before, so you can save stuff easily.
- No need to wrap code in PHP tags. It does it for you. (No raw HTML in this version, sorry!)
- Safe enough. It uses a session based password-login system. You cannot use it without giving it a new password. Don’t leave it on a production server.
Some day, some extra or more refined features could be better.
- Better naming. It’s really hard to pin down a file you want after you make it the current way.
- Real history, not strictly session based.
- Maybe validating HTML? It’s not the most important thing but I feel there is a standard to uphold.
- Better interface? It’s pretty basic as it is. I think that by adding features, it’ll become more advanced.
The entire thing is in a single file and it’s just under 11KB. Here is the source code the for the PHP Executer: PHP Executer Source Code. It really is just one file.
Hope someone can find some use for it, please a leave a comment if you try it out.