Blog of Jeff A blog about programming and random other things.

9Apr/09link

Why Google App Engine Shouldn’t Include PHP

I've recently been increasing my interest in Google App Engine (GAE) for some upcoming projects I have in mind. The top feature request is to add PHP support. This is definitely a mistake for Google to adopt this.

Sure, PHP may be "the most popular language for the web". But that's mostly because of being the best first. Being one of the earliest languages for the web, it grew with no major competition. When there's no other better choice, it obviously grows rapidly.

Guess why C/C++ is the most popular language in the world today? It's because it was one of the first languages. Ruby, Python, Java, weren't around then. Fortran was getting outdated and no one wanted to write a bunch of parenthesis on dedicated LISP machines.

The web hosting market is already saturated with plenty of decent PHP web hosts. It is trivial to deploy PHP servers and decently fast in comparison to other languages. Linux distributions allow integration with apache easily with provided packages (apt-get install apache2 mysql php and you're set).

The primary advantage GAE provides is the scalability, but there are plenty of PHP sites that scale just fine. There are few large-scale PHP web applications all run on their own cloud-like server systems (Facebook, Yahoo, etc.). Even if you're an extremely popular php-powered application, simply switching to AWS wouldn't be as much hassle as ruby or python due to php's ease of setup.

Since Google isn't a PHP shop, it's less likely the PHP features will be well supported as opposed to Ruby or Java. Just because customers want it doesn't mean they should support it. Enthusiasm towards that particular feature is important. But that isn't the whole problem. Try checking out your closest Microsoft product.

It's an assumption by non-PHP programmers that PHP developers are beginners. While I'll agree not all PHP developers are beginners, having an expert language designer at the helm of your language of choice definitely helps. Making some mistakes when designing your language is acceptable, but PHP has plenty of left-overs from its earlier venerable days. Features such as PHP's safe_mode are just hacks for bigger security problems which were attempted to be addressed.

You may not think about it much, but in a way, It's like a credit score: would you want to use a language that has a large history of security flaws? I'd like to know the features I investigate have security in-mind, or at least adequate documentation about possible security implications. For example, there's no mention of possible SQL injection in the documentation for mysqli::query.

(digression)

This is part of a larger problem of PHP, the documentation lacks good education for its users. And like school systems, better education correlates to smarter students. The thought that most PHP programmers are beginners isn't an accident, it's intertwined with the language's less than ideal documentation.

(/digression)

More effort is required to support these beginners. And for any company, this results in costlier maintenance. Both in consumer support and security standpoint. If your users are less aware of security, your systems are more likely to be exploited. Better hope you sandboxed all the loopholes.

Adding PHP is also has numerous hidden costs. Besides PHP support, most PHP users would want mod_rewrite, MySQL, safe_mode off (although this will be permanent in PHP6), etc.. PHP is like the gateway drug to more feature requests that cater only to PHP. And having MySQL would greatly alter the current nature of GAE's underlying systems, including BigTable, Google's own database system designed for scalability.

After you have the entire suite of software to get PHP running like most PHP developers prefer, what makes Google much different from other cloud based solutions (other than a great deal for developers and a pain for Google sys admins, but all companies need to be profitable)?

Just seeing the ticket comments, it's evident a decent amount of PHP developers also want MySQL support too. It's because many PHP applications are already so dependent on PHP. Even the very popular wordpress only supports MySQL.

I'm guessing here, but most PHP users just simply deploy PHP-powered applications, not actually write their own from scratch. Recently, I've only use PHP for two things: small, quick projects and using/tweaking someone else's code. Nearly all of existing PHP code assumes you're on the LAMP architecture, and guess what PHP users want for GAE to support?

---

I don't mind PHP as a language. It has a place it the web world, but PHP doesn't fit in Google App Engine. Even if PHP is supported, most of the popular PHP applications won't work. If you just simply like to write in PHP, I don't have much against you for wanting GAE to support PHP.

If you're disappointed about that, don't worry, there are tons of alternatives available, Google isn't the end-all solution to hosting. You could always ask Yahoo! to open up their servers to the public, at least they're PHP shop ;)

  • Share/Bookmark
  • it is really good site and there are more good information!
  • thatonedude
    by the way your guest post still require a registration so its not really guest. and the registering to make my first post crashed my browser. niiiiiicccccccceeeeeeeee!!!!!!!!!!
  • thatonedude
    "It's because many PHP applications are already so dependent on PHP."
    yes. you are so right lol. personally i like flatfiles(inject that), yes.....even for forum builds. and any language is not going to be secure if you dont do your homework.
  • I agree that PHP shouldn't be supported the way we know it. I think PHP support is coming but before you hurry into your cms.zip or framework.zip mind that what we use everyday to build our web apps isn't just PHP.

    It is a mix of PHP + tons of modules. That's how PHP works and it works great. But perhaps not so well in a wild environment such as GAE.

    GAE is nice, but you have to know how and for what to use it.
  • Richard
    You said - "Just because customers want it doesn’t mean they should support it"

    Then I guess they should shut down their business for good!
  • There's a large customer base. Satisfying *everyone* makes no one happy. For
    example, 37signals says
    no<http: ch05_start_with_no.php="" gettingreal.37signals.com="">to plenty
    of features. Are they out of business? Nope. Apple's iPod still
    doesn't have a lot of features its competitors have. Does that make it a
    failure? PHP support is a feature
    loop<http: ch05_hidden_costs.php="" gettingreal.37signals.com="">;
    after users have PHP, they'll want MySQL, php module *x*, etc.</http:></http:>
  • udkl
    """The web hosting market is already saturated with plenty of decent PHP web hosts. It is trivial to deploy PHP servers and decently fast in comparison to other languages. Linux distributions allow integration with apache easily with provided packages (apt-get install apache2 mysql php and you’re set)."""

    There you go ..... you just voted for PHP......
  • For other hosting providers, sure I "voted" for PHP. After all, they host
    exclusively PHP. GAE doesn't officially (and shouldn't, in my opinion,)
    support native PHP. There's little Google can do to stand out from other PHP
    hosts.
    - Jeff
  • Last Post!
    "Guess why C/C++ is the most popular language in the world today? It’s because it was one of the first languages. Ruby, Python, Java, weren’t around then. Fortran was getting outdated and no one wanted to write a bunch of parenthesis on dedicated LISP machines."

    That doesn't make any sense at all! Never mind that "C/C++" isn't a language: it's two very different languages separated by over a decade. The latter is called "C++" because it came after "C", which is called "C" because it came after "B", which in turn came after "BCPL", which came after "CPL". You've explicitly picked languages whose names tell you how they're descendants of other languages. :-)

    I have yet to see nontrivial Lisp code with more grouping symbols than the corresponding C or C++ code, so I'll ignore the "parentheses" swipe, but Lisp machines are younger than C, and *commercial* Lisp machines are younger than C++. Not a competitor.

    I could list languages older than C all day (Pascal, Algol, APL, Forth, Logo, BASIC, Prolog, ...). Would you take a cheap swipe at all of them, too? Some of them are really fantastic languages, with awesome features we still don't see in hot-shot languages like Ruby and Python.

    And if you admit that C/C++ was merely "one of the first", then what about the ones that came before it? Is your winning strategy for language adoption to be "one of the first"? Is, say, 17th place the winning slot? :-)

    If you've come up with a new theory as to why C and C++ are more popular than Lisp today, you should at least acknowledge Dr. Gabriel's "Lisp: Good News, Bad News, How to Win Big", and why your theory is different from what we've known and accepted for 20 years. Because the existing theory does pretty well for even newer languages, and yours seems to fumble over the details of even the older ones.

    (That sounded way snarkier than I'd planned. Sorry. I agree with your premise that PHP is a poor fit for GAE. I guess it's just a pet peeve of mine, that people in computing know the history of their field less well than most other fields.)
  • My intention of grouping C++ with C is that it helps contribute to it
    popularity, rather than developers switching to completely different
    language for an OO. Being C-compatible (which is a good & bad thing)
    definitely helped its adoption by some C programmers.

    But, I stand corrected. I'm definitely not well-informed on CS history.
    Thanks :P
    I probably should of said something else other than "first language" which
    seems to draw lots of heat.

    - Jeff
  • Google is not doing any charity out there. They are sensing money out of GAE and exactly for this reason they want it be a popular among the more and more developers of various platforms. So i think google will definitely add PHP support to GAE and for developers and promoters of the PHP projects will benefit from it commercially and google obviously.
  • Well that's the thing. It's a cost-vs-revenue. There would be a lot of time
    spent implemented to get most of PHP's features (including MySQL) into GAE
    since that are what most PHP developers are accustomed to. That requires
    either a modified version of PHP or changes to the GAE server architecture.
    If MySQL isn't supported (which I doubt), then most PHP users won't use it
    which results in less possible profits.

    Even if MySQL is supported, Google loses money for developers that host PHP
    applications since PHP's low resource-consumption means less PHP developers
    will actually need to pay for anything.

    There are some large PHP-powered web services out there, but how many of
    them are out there that don't utilize their own servers? Vimeo, Facebook,
    Yahoo all run and maintain their own servers (I'm actually guessing for
    Vimeo, but their domain points to their parent company's nameservers).

    The only PHP application that *might not* be self hosted is Digg. That's the
    only one I can grab off the top of my head.

    - Jeff
  • Nat
    GAE already supports PHP, Groovy, Ruby, Java, Python and others.

    Read before your post, although ignorance is a bliss ;)
  • Nat
    Oh dear, it's incredible how ignorant people are. You are clearly a close-minded programmer with no notion of technology nor business.

    Technology:
    GAE doesn't need to support MySQL. There are plenty of alternative storage engines, like Redis that was specially engineered for the cloud.

    Business:
    Digg, Facebook? What the hell are you talking about mate?


  • GAE doesn't need to, but there are plenty of PHP developers that WANT Google to. GAE already uses BigTable, which is basically a hash (like Redis). I'm basing my argument on the observation of various PHP users (especially on Google's PHP request ticket).

    I mentioned those companies since some commenters mentioned as if PHP scaling was an issue. Which is obviously not a problem since there are other PHP-powered companies scaling just fine on their own, without the need for cloud services.

    I may be more close-minded than I like, but I'm not that close minded (at least I hope :P). I can't tell you about countless PHP users that are perplexed when MySQL doesn't work.

    And in response to your reply below: I'm specifically talking about OFFICIAL support by Google. Most of those you've listed below are unofficially supported through Java. I prefer that over official support since official PHP support would trick many PHP users that MySQL (and all its MySQL functions in PHP) would function correctly, which obviously won't
  • Nat
    Most of the PHP programmers I know are Java developers and have more experience that you can imagine. Some of them have been developing in Java and PHP for more than 10 years. They've worked with Oracle, MS SQL Server, IBM DB2, MySQL, Postgres and others.

    What's funny is that you are always associating a databases with MySQL. I always thought flash designers didn't have a clue about databases, now I know it's true ;)
  • Congrats, your friends that know PHP and Java seem like a rarity in parts of
    the world I hang around. :/

    Then tell me, what's wrong with the current GAE setup using quercus? They're
    familiar with Java and PHP so there shouldn't be much of an issue there.
    I'm perfectly aware that there are plenty of other databases out there. But
    the average PHP user only knows of MySQL, a new PHP user would probably
    search for php database or something similar. All the results would return
    topics on using PHP with MySQL.

    If we're just checking on search terms let's see:
    http://www.google.com/trends?q=php+mysql,+php+postgres,+php+oracle,+php+DB2,+php+couchdb&ctab=0&geo=all&date=all&sort=0

    <http: trends?q="php+mysql,+php+postgres,+php+oracle,+php+DB2,+php+couchdb&amp;ctab=0&amp;geo=all&amp;date=all&amp;sort=0" www.google.com="">I
    don't know about you, but mysql seems pretty popular. But that's the
    problem, too popular. Many PHP users have this blind side for any other
    database out there.

    Since your friends are familiar with Java (and more importantly other
    databases), they don't fall under the typical PHP user.

    My definition of "typical" PHP user also encompasses those that just deploy
    PHP applications: drupal, wordpress, phpnuke, etc. they don't have much
    intention to invest deeply into PHP, just to get their site up. And there
    are plenty of those people.

    Finally, I don't know where you came up of the idea that I was a flash
    designer. I'm not.

    - Jeff</http:>
  • Federico
    I think you are living under a rock. 2 things:

    - Quercus (google it)
    - No need to wait for Yahoo, Microsoft Azure is adding support for PHP :)
  • Robert
    I agree and wholeheartedly at that.
  • alex
    u are standing on the way of revolution, this is fucking bad position, evolution rules, so when u saying stop using one and begin using two, u are wrong! php is open source, go and make it better, why u supporting another revolution?
  • You can already do (limited) PHP using Quercus over the JVM in the new GAE/J. Actually neither Python, nor Java are fully supported. To use the GAE you have to wrap yourself over the "limitations" in order to gain the benefits of being in a super-scalable platform.
  • henk
    I agree with the author that 'official' PHP support wouldn't make much sense. Many people assume MySQL to be part of PHP and that's where the problems start. Contrast this with some other platforms that make no specific assumptions about any particular DB and have abstracted DB access from the very beginnings behind a general API (ODBC, JDBC, etc).

    Just supporting the language syntax would be relatively easy, and thanks to Quercus and the JVM in general supporting the PHP base libraries is absolutely a breeze. Quite problematic is supporting al the various third party libraries and mods that have been implemented under the hood in C. These will simply not run on GAE for now, and quite certainly not in the future either.

    No matter how you put it, the main attractiveness in PHP is for beginners. Yes, professionals can build beautiful things in PHP, but that's more by virtue of the intelligent mind of said professional and not perse a virtue of PHP itself. It's beginners who, I think, have a very hard time understanding why the script they copied from phpfreakz doesn't run on GAE. They won't understand that one 'half of PHP' (that's MySQL for them) doesn't work, while the other half of PHP (while loops etc) does work.

    Of course, Java programmers too have to understand that GAE is not like the regular JDK they normally work with. As clearly reported everywhere, many standard Java things are not supported. Files, Timers, Session Beans, Managed Beans, Threads, probably JTA and transactions in general etc. All of this is missing from GAE. Somehow, it think Java programmers are more able to cope with this. Most of them are already uses to a number of more or less different Java environments like Java SE (commandline, Swing apps), Tomcat*, Java EE , Java ME, BD-J, Spring and also from Google: Android. Whereas most PHP programmers are just used to... LAMP.

    (*)
    Tomcat is of course officially a subset of Java EE, implementing the Servlet and JSP specs. It's so popular however that it by itself became a kind of distinctive Java execution environment.


  • Your comments about PHP would've held good before PHP 5. Right now, its at par with Ruby, ROR or perl when it comes to security. And with PHP 6, it may even become better. And as far as GAE using PHP, I'm sure they will not use a barebones installation without tweaking for performance and security. If its deployed, I'm pretty sure its safe.

    And as far as usability is concerned, I don't even want to get started. PHP is THE easiest web scripting language. And I'm sure GAE will have more takers if its included.
  • I'll agree with you about PHP security improving, but the education hasn't been up to par.

    If Google does deploy PHP, it'll be likely sandboxed like Python, but, as far as I know, no PHP sandboxing application exists. Python has pypy which can sandbox a python interpreter. Even if pypy didn't really exist, but Google has Guido, who is intimately knowledgeable about python (since he designed it).

    I didn't say PHP was a hard language to use (why else did it become so popular?) I'm glad PHP is easy. After all, it's how I started learning programming. :)

    Google also probably considers the profitability of supporting a new language. Besides the oversaturated PHP hosting market, I'm betting most PHP applications can run well below the free limits for most users. As much as free as Google is, the current economy has put Google is a "lockdown" state, attempting to cut back costs while generating more revenue from its products.
  • rakesh juyal
    hey, did u just said, 'ruby or python or java is powerfult than c/c++'.
  • I don't recall ever saying that here. Unless your definition of more powerful is by how new it is...

    Ruby, Python & Java are cater towards programmer productivity at the sacrifice of low-level capabilities.
  • mardix
    Bashing PHP? BTW are you running WordPress? Hilarious.

    PHP was meant to be easy and fast. I will never say that PHP was safe, but it wasn't the concern from the beginning, but pains were growing as the web was getting more mature. And all those headaches and backaches have their medicines in PHP 5, PHP 6. Unless you are under a rock and keep ignoring all the efforts done by the PHP community to patch stuff up, make PHP5, PHP 6 soon, stop using PHP4 period.

    PHP wasn't the first. Other people have mentioned of Perl, imo ASP was there too. Back to my first point PHP was meant to b easy and fast. We have the freedom to do whatever. It wasnt about writing beautiful codes, but codes that worked.

    "The documentation lack good education"
    Are you kidding me. What type of education you wanted, step-by-step one? Well if you are programing, some how you should have some type of common sense.

    And before I go, PHP is awesome because it's awesome period. Easy to develop with no frameworks (hint hint: ROR), beautiful bundle with: Linux,Apache,MySQL. Large community for help. Thousands and thousands of code snippets. PHP is genial, PHP is the best. And your blog is running on WordPress.

    P.S: ROR developers are Frameworkers. lol.
  • Completely bashing PHP wasn't the point of my article. Sorry if you thought
    so. I intended to argue why PHP shouldn't be in GAE.
    ASP was rather limited due to the enormous popularity of Apache & GNU Linux
    over IIS & Windows.

    "Are you kidding me. What type of education you wanted, step-by-step one?
    Well if you are programing, some how you should have some type of common
    sense."
    Common sense if you've done programming before, but you can't assume
    everyone is at the same level as you. There's also lack of official code
    examples. Comments which provide code can be a hit-or-miss. Humans learn
    best by copying & applying. Not by reading or listening.

    Yes, I'm running Wordpress. I like the irony :)
    - Jeff
  • Your title and part of your article seems to imply you oppose GAE to support PHP, yet in all your reasoning I gather more that you don't like GAE to support the full LAMP stack. And you don't want Google to do that because "most PHP users are beginners".

    So, how would you feel then if Google would only support PHP. No MySQL and such. Just PHP. That would weed out the majority of those "beginners" and mean that only professional, skilled PHP developers would use GAE. Would you be fine with GAE supporting PHP if it was like that?

    I am aware of the fact that many people think PHP is mostly crap because most PHP users are crap developers. And yes, it is partially true. But don't make "us" serious PHP developers suffer because of that. That is just plain stupid. There are serious PHP developers outthere, and also those who would like PHP support for GAE. Let us also use the power of GAE, please?
  • I'll have to agree with you that wouldn't be completely against if only PHP was supported, but that's a fine line to walk. I'm not aware of the amount of PHP professionals that would be willing using GAE just for PHP (as most frameworks wouldn't work). If only PHP was supported, I can predict a wave of new PHP-styled feature requests rolling in.

    This worries me since the PHP feature request is a lot more popular that it really should be. The ticket issue is filled with users saying, "PHP is the most popular, so support it!" and "Google should add [insert php application here] support". Both are not good reasons to add support for PHP.

    Oh, and I did mention that Google doesn't officially use PHP, which would require them to (a) hire someone who's passionate about PHP or (b) attempt to do it themselves. Programmer's enthusiasm for these major features is important. In addition, there isn't "the" PHP framework which Google could port to increase adoption, the variety of PHP frameworks are too numerous and splinter the fan base.

    After that, what Google brings to the table doesn't seem completely breath taking. Especially since most other webhosts can service nearly all the PHP users just fine: from the extremely cheap, to the scalable cloud. PHP users already have that stuff.

    You can also apparently get PHP to work under Java right now (see comment above). I'm not sure how good is it.
  • BradMc
    How do you mention PHP, Java, Python and Ruby in the context of the history of web development, and not mention Perl at all? Wow.
  • Sorry, I'm not an avid Perl user for web development. I chose to avoid it than say unverified opinions.

    Just wondering, do you happen to know how much perl is used at Google or Yahoo?
  • I find it amusing that you posted this just minutes after another of my friends wrote his Quercus instructions:

    http://brian.brispace.net/2009/04/09/php-on-google-app-engine/

    =)
  • "But that’s mostly because of being the best first. Being one of the earliest languages for the web, it grew with no major competition. When there’s no other better choice, it obviously grows rapidly."

    That's just patently false. PHP was far, far from the first. Perl was extremely popular for web apps (and still is, powering several high-scale sites today). C wasn't uncommon for a while either.

    That said, I agree PHP sucks. ;-)
  • True, I probably should of elaborated more on its ease of use over competing languages at the time.

    Probably the most outstanding feature of PHP VS other languages was it's that is defaulted to opening html text. Printing out html lines all day long isn't quite as fun :P
  • Aman
    Just use Quercus, now that GAE supports Java.
  • Drew
    All this PHP bashing done on a blog application written in PHP...interesting!
  • I'm only bashing the official support of PHP for GAE. Not in general purpose use :)
blog comments powered by Disqus

Recent Posts

Topics

Archives

Following

Links