Categorized | News, PHP

PHP Shell Gets Even Better

Posted on 15 June 2006 by Demian Turner

As recently commented, PHP has been in great need of a decent shell environment for some time now and, as users of Python and, even better, Ruby’s irb will maintain, access to all the language’s constructs and libs at the commandline is a great timesaver and should be a standard feature for all scripting languages.

Luckily for PHPers Jan Kneschke has come to the rescue and implemented PHP Shell in userland PHP, which provides many of the features that come by default in the aforementioned languages’ interactive shells. If your PHP is compiled –with-readline support even better, standard up-arrow command history is available, as is the ability to backspace into the code you have written but not yet executed.

What is newsworthy about PHP Shell is that it has recently was made available as a PEAR lib, so it’s just a matter of

$ pear install PHP_Shell-alpha

and then execute the php-shell.sh script which is discoverable in your PATH if you’re using Linux (or there is a cmd equivalent for Windows users still on the dark side).

Although the docs section of PHP_Shell is still empty at the PEAR site, a README is available with the package with all the basic info you will need, or just type ‘?’ at the command line once interactive script is running.

I personally think this is one of the more exciting PEAR releases to come about in a long time. Not to diminish the importance of the steady and voluminous release of packages enjoyed by the PEAR project (and more so by PHP users) over the last months, but PHP Shell is something I will use on a daily basis as part of earning my living as a programmer, along with phpDocumentor, PEAR::Log and Mail and many of the bread and butter packages required for any decent web app.

At a time where the trend is to move away from PEAR, or to rewrite many of the PEAR libs from scratch instead of improving existing work (ezComponents, Zend Framework), I tip my hat to the hard working PEAR community and wish the project the continued success it deserves, despite current fashion trends.

Bookmark and Share

9 Comments For This Post

  1. Anselm Says:

    Note that Php Shell is still in alpha mode – so the default Pear config will not install it. You can either download it manually, or use the -f switch :

    pear install -f PHP_Shell

  2. Demian Turner Says:

    Thanks for pointing that out, I always run in devel so never notice 😉

  3. Krzysztof Kotowicz Says:

    You could also use pear install PHP_Shell-alpha

  4. Chris Shiflett Says:

    > to rewrite many of the PEAR libs from
    > scratch instead of improving existing
    > work (ezComponents, Zend Framework)

    Should Seagull be part of that list? 😉

  5. Demian Turner Says:

    Amazing, I guess you really can learn something from comments 😉

    Chris, FYI the Seagull framework is built *on top* of PEAR libs, was one of the first adopters of things like DB_DataObjects and Flexy templates, and has provided stacks of bug reports and some patches to the PEAR community in the 5 years of it has been working with PEAR. A default Seagull install comes with around 22 PEAR libs.

    I can’t think of a framework project out there in PHP land that is more dedicated to the PEAR effort.

    We were also one of the first to make full use of PEAR channels, and provide tools for gui frontend to download channel packages.

    Now as you’re apparently interested in the subject, and a ZPF contributor, what’s your take on my comment now that you’re a bit more informed?

  6. Chris Shiflett Says:

    I don’t have a strong opinion about these things, so I doubt my perspective will interest anyone. I watched the panel at php|tek on frameworks, so I did get a better idea regarding some of the design decisions. One thing worth noting is that ZF is designed to coexist peacefully with other component libraries such as PEAR. I don’t think there’s too much direct competition, because PEAR will never want to be a framework, and ZF will never have many components.

    Even if there is some direct competition, I don’t see reinventing the wheel as disrespectful. We’re all different, and sometimes the PEAR solution doesn’t suit us for some reason. (I can say the same thing about the ZF solution in some cases, of course.) That’s why I think CPAN will always have us beat. As Andy Lester so eloquently puts it, “CPAN thrives because of the unfettered uploading of shit, not in spite of it.”

    Anyway, thanks for the quick explanation of Seagull. :-)

    P.S. Your comment system needs some nl2br() action.

  7. Hick Says:

    Could the command “pear install PHP_Shell” install it successfully? it came out this in windows xp:

    Failed to download pear/PHP_Shell within preferred state “stable”, latest releas
    e is version 0.3.0, stability “alpha”, use “channel://pear.php.net/PHP_Shell-0.3
    .0″ to install
    Cannot initialize ‘PHP_Shell’, invalid or missing package file
    Package “PHP_Shell” is not valid
    install failed

    I installed it by the command as the following at last:

    pear install channel://pear.php.net/PHP_Shell-0.3.0

  8. Demian Turner Says:

    I’ve been using this weblog for > 1 year and didn’t realise you had to enable the nl2br plugin to sort the comments – that’s what I call plugin-based architecture 😉

  9. .: blogging augusto :. Says:

    Das Entwickeln mit PHP macht Spass. Es ist ziemlich einfach möglich auch komplexere Aufgabenstellungen umzusetzen. Jedoch finde ich Fehler meist erst durch Testläufe meiner Software.

    Als ich mit Python entwickelt habe fand ich die interaktive Shell ung

1 Trackbacks For This Post

  1. PHP shell rocks | PHPkitchen Says:

    […] written about this before, but since the interactive mode of PHP (php -a) seems to be broken on OS X, I think it’s […]

Leave a Reply

Categories

Books

Demian Turner's currently-reading book recommendations, reviews, favorite quotes, book clubs, book trivia, book lists

Facebook