LWN.net Logo

PHP as a General-Purpose Language (Linux Journal)

This Linux Journal article says that PHP isn't just for web scripting any more. "Although most people use PHP primarily as a Web development scripting system, it possesses all the characteristics of a proper general-purpose language that can be useful in a variety of other environments. In this article, I illustrate how it's possible to use the command-line version of PHP to perform complex shell operations, such as manipulating data files, reading and parsing remote XML documents and scheduling important tasks through cron."
(Log in to post comments)

Sorry, I must rant.

Posted Aug 18, 2004 18:15 UTC (Wed) by doodaddy (guest, #10649) [Link]

<RANT>

Does anybody know why languages like PHP insist on becoming "general purpose"? The last thing I need is yet another general purpose language.

I had hopes that PHP would become more web capable as it grew. I had hoped for more ways to embed PHP and HTML in each other. I had hoped for low-level things like good session management and "back button resistance". And I hoped for middle-level things like a model for defining widgets built-in. I wanted the PEAR library to be more complete and less like a random collection of half-finished, unrelated toy projects. I could go on with high-level ideas I suppose are on every web programmers' mind. In short, I had hoped for web specific upgrades.

Instead I get another language with a decent object model and exception handling. And here I thought PHP was a scripting language. My last job could have used Perl but PHP was the simple "web focused" Perl. (When I look at Perl's Mason or template system, I get jealous.) If we wanted objects, I suppose JSP must have them.

How many more language do we need that just pick over the subtle, well-known trade-offs in procedural language design?

I guess PHP is showing it's true colors -- a class project that was clunky and simplistic, but disguised well as a purposefully simple, easy-to-learn language. (Because we need another one of those like another hole in the head.) It was also confounded enough with the web to again look purposeful in that pursuit. But as the PHP corporation has grown and has had many years, PHP has become the latest me-too, pointless Java wannabe.

Lame.

</RANT>

Sorry, I must rant.

Posted Aug 18, 2004 22:49 UTC (Wed) by JoeBuck (subscriber, #2330) [Link]

You forgot the most important part of the rant: PHP is a never-ending source of security holes. Many of these holes are avoidable if great care is taken, but the more the language grows, the more there is to worry about.

Sorry, I must rant too!

Posted Aug 19, 2004 19:58 UTC (Thu) by holstein (subscriber, #6122) [Link]

Many of these holes are avoidable if great care is taken

The problem is the development process of PHP. Or the lack of it...

I was at the PHPQuebec Conference, in Montreal last year. At the end of the conference, there was a question session with the 10 or so developpers with @php.net addresses. One of the questions was "what is the process to get a feature accepted in PHP? How is this discussed?". The answer was "there is none. The one that want to add the feature does it and if nobody say anything against it, it stays".

Wow. We are soooo far away from the Python PEP or the Perl Apocalypses/Exegesis...

Sorry, I must rant.

Posted Aug 19, 2004 15:00 UTC (Thu) by adam@linuxbox.nu (guest, #16734) [Link]

I see and understand your points, but it's not all bad. For instance, I'm working on a project that has a web interface and command line tools. Since PHP supports and works in both environments, I am able to reuse my PHP classes in both interfaces. This has greatly reduced the development time and centralized the majority of the code. Being able to do that is actually a big plus in my book, even if it does feel a little funny using PHP where Perl or Python would be generally used.

Sorry, I must rant.

Posted Aug 24, 2004 22:14 UTC (Tue) by koide (guest, #22687) [Link]

<quote>...but disguised well as a purposefully simple, easy-to-learn language.</quote>

It is not disguised at such, it IS simple and easy to learn. And that's where its beauty resides and what makes it not pointless.

On the rest, I agree it's a mess. But some good projects, such as Smarty, JPGraph or ADOdb, show real work can be done using the language. (as in almost any other language, of course).

Nonetheless, I think the PHP group really needs to rethink its process (or even create one), and set specific goals and directions.

Sorry, I must rant.

Posted Sep 15, 2004 7:46 UTC (Wed) by job (guest, #670) [Link]

... and shortly after you had this discussion, PHP had yet another remote
exploit.

Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds