I Can't Believe It's Not Blogging

The Message is Medium Rare

PHP Command Shell

Jun 14 2003

Last week I wrote an interactive, command line PHP interpreter, and I've decided to post the source code here.

It's version 0.1, and it comes with a boatload of caveats: it only works under UNIX, and for that matter, only on UNIX systems that have a PHP interpreter installed in someplace like /usr/local/bin, which means that you either downloaded or installed with the CGI option. It doesn't support niceties like line continuation or command history convenience keys. Most of all, it's pretty simple. You could have probably written this in half an hour if you'd thought of it.

But it does do its basic job: processing each line you type in as PHP code. Variables that are set get remembered. If you want the shell to return the value of an expression, just don't end it with a semicolon or brace, and it'll give it back to you. You can always use echo if you want, too.

When you invoke it, you also have the option of giving it arguments that represent the names of one or more php files to be included prior to starting interaction. This gives you essentially the ability to run test bed scripts and then check values or code interactions to see if you're getting the behavior you'd expect.

I'll be writing a more complete FAQ for it before Too Long (TM). Please drop me a line if you're interested in this, especially if you'd like to help add missing features.

Comments

Weston, I tried sending you an email on Monday and it didn't work. Hopefully this will. I saw you on Sunday at regional conference with Dave and Ty and Alisha and the Meyers and the 3 siblings that I can never remember their names. YOU SHAVED!!! I was shocked, I admit it. I would have come down to say hi, but "traffic" was headed up and you guys were down on the floor. As I mentioned, I tried to email you on Monday, but it didn't go. I was going to check your address out soon, but last night I went to an activity with Delana at her ward. It was a progressive dinner. Well, since it was a group of people I didn't know, I asked if anyone in the car had heard of the 8 at 7 thing. One girl, Rachel, had. She mentioned that she went on Saturday. She was talking about the people she met and (my hearing being what it is) I heard "classic guitar" and "Weston", so I figured it had to have been you. So I asked, and it was. Of course, I had to tell them that you're awesome. This leads into a question for you. Now that I heard somthing from a girl, since I've signed up for the July 8 at 7 thing, I want to know what a guy thinks of it. How is it? Ok, I really should get back to work. Later, PJ
2004-06-17 10:24:17
PJ Keck

Leave a Reply