Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×

PHP 5 Released; PHP Compiler, Too 524

TheTomcat writes "After years of anticipation, PHP 5 was released today. This release represents a milestone in the evolution of PHP. It sports the new Zend Engine II, a completely re-worked object model, and many many new features. Check it and the changelog out." In other PHP news, remote_bob writes "There have been many attempts, like BinaryPHP and PASM, but finally there is a complete compiler for PHP. The Roadsend compiler produces standalone, native executables, and supports the entire PHP language (but not all extensions). It uses Bigloo Scheme to do its job, a variant of Lisp, the language that Paul Graham writes about. Benchmarks say that performance is pretty good. Is this another sign that dynamic languages are the future?"
This discussion has been archived. No new comments can be posted.

PHP 5 Released; PHP Compiler, Too

Comments Filter:
  • Goodbye Perl? (Score:3, Interesting)

    by FyRE666 ( 263011 ) * on Tuesday July 13, 2004 @06:46PM (#9691691) Homepage
    This may well sever my last remaining link with Perl. While I used to ride the camel for web and shell scripting, I've now moved entirely to php for the web, and mostly php for shell scripting, with Perl used when its extra speed is useful. Presumably compiled php will eclipse Perl for scripting use now though, so (on Linux at least) I'll probably convert fully. Pity I have to stick with sed, awk and shell scripts on our old HPUX servers though...
  • Cross Platform? (Score:2, Interesting)

    by blackmonday ( 607916 ) on Tuesday July 13, 2004 @06:48PM (#9691710) Homepage
    How is the cross platform ability of PHP? Can I write an app un Linux and comile and run it on OS X and Windows? Does it need a runtime, or is it bundled? Seems like an intriguing alternative to .NET.

  • PHP5 (Score:5, Interesting)

    by mfh ( 56 ) on Tuesday July 13, 2004 @06:49PM (#9691717) Homepage Journal
    Some folks were suspicious of PHP5, and being a longtime PHP programmer, I am very pleased with the changes and additions in PHP5. Can't wait to test it out. Personally, I'm not sure if I'll use *all* of the new stuff, yet I'm sure I'll have to play with the coolest additions for the hell of it, and sort out what I'll be using and what will remain vestigial in my scripts. I will add that some of the previous PHP version quirkiness seems to be fixed.

    I am certain this is not the last we'll hear about PHP5 on Slashdot, yet I am only hoping that it's creative/cool stuff, and not security problem/exploit stuff.

    I can't wait to see what kinds of changes I can make to my content management system [sf.net] that PHP5 will bring.
  • Re:Goodbye Perl? (Score:5, Interesting)

    by KevinKnSC ( 744603 ) * on Tuesday July 13, 2004 @06:53PM (#9691748)
    I agree, this makes it hard to justify something besides PHP in a lot of situations.

    It's too bad the compiler is $399 per year, and only currently available on Linux. If it was a little less, and not licensed annually, I'd be uninstalling a lot of other development tools right now.

  • PHP Object Model (Score:3, Interesting)

    by Eberlin ( 570874 ) on Tuesday July 13, 2004 @06:54PM (#9691760) Homepage
    A good reworking of the PHP object model was definitely in order. Inheritance was a bit weird, destructors were odd to work with, and there weren't ways to declare stuff private.

    The bigger question is compatibility. Will older code be ok? When will mainstream hosts migrate to the newer version? It'll be scary to find systems borken because of version updates.

    As for a compiler, I'm not sure I'm comfy with the idea. Always figured if you wanted to write code for native compilation, you'd hack in C or maybe C++. Not that PHP wouldn't have its uses...as PHP is really handy and greatly increases the speed of development.
  • by killermookie ( 708026 ) on Tuesday July 13, 2004 @06:55PM (#9691769) Homepage
    Ever since I picked up George Schlossnagle's Advanced PHP Programming [slashdot.org] as few weeks back I've been using PHP5 RC3 to get used to the new Object-Oriented layout. It's my first real step into using strong OO in my web application and I'm learning a lot!
  • Compiled vs Cached (Score:5, Interesting)

    by chill ( 34294 ) on Tuesday July 13, 2004 @06:55PM (#9691774) Journal
    If speed and not closed-source is your main consideration, then how does the Roadsend compiled code stack up against interpreted code fed through the Zend Accelerator, the Turck MMcache or other caches?

    mmCache is OSS and free (as in beer), which is a big plus in my book.

    -Charles
  • $$ for compiler (Score:2, Interesting)

    by hkb ( 777908 ) on Tuesday July 13, 2004 @06:56PM (#9691780)
    Uhm, the compiler is priced at a low, low introductory price of $399. I don't think it'll be taking the *NIX world by storm any time soon, or cause mass adoption to PHP executables anytime soon.
  • Re:Goodbye Perl? (Score:2, Interesting)

    by defsdoor ( 737019 ) on Tuesday July 13, 2004 @07:00PM (#9691805) Homepage Journal
    I thought I was the only person that used php for scripting too. I've got a landline call rating system that runs superbly written entirely in php.
    It started out as a prototype but worked so well and fast that it stayed.
  • by Dr.Dubious DDQ ( 11968 ) on Tuesday July 13, 2004 @07:04PM (#9691827) Homepage

    I can vouch that, to the extent that I've been trying it, all of my PHP4-developed code has been working fine with the PHP5 interpreter so far. As andig suggests above, I suspect that only a few cases where someone relies heavily on 4.x "quirks" will cause a problem.

    I was slightly disappointed to find that the "native Java/PHP integration [php.net]" support was quietly dropped from PHP5 - I'd been wanting to play with that. Oh well.

  • by abes ( 82351 ) on Tuesday July 13, 2004 @07:10PM (#9691862) Homepage
    I used to really be into PHP. It was great for creating a webpage in little or no time. It's syntax, while maybe not perfect, was pretty good. Until, that is, I tried to start developing my own libraries, and ran into weird quirkiness with object design, and trying to figure out the best way to do libraries, etc. It looks like PHP5 might fix the problems I had with how objects worked, and I'm not sure if it was my own fault with the messy libraries I ended up with, or whether I didn't find the best way to do it in PHP, but I eventually moved to Python out of frustration.

    I had avoided Python for a long time, as I really disliked (and still do) the indentation-matters issue. But besides that, and its own set of quirks, it's a really great language, and for larger projects I have trouble even thinking about going back to PHP.

    I think the biggest selling point to PHP over other solutions such as Python is that its simple. You don't have to make a whole of choices. For example, with Python you have a large number of packages to choose from: Zope, mod_python, twisted.web, Python CGI, and a bunch of variants on these. While choice can be good, it can also be overwhelming (like how do you know which package to go with until you've tried them all?).

    I think I am not alone with some of difficulties I faced with PHP. So while it's great to hear that PHP has fixed many of its bugs, I think its worthwhile for people to also look at other solutions out there.

    Just my $0.02.
  • Re:$$ for compiler (Score:3, Interesting)

    by Saeed al-Sahaf ( 665390 ) on Tuesday July 13, 2004 @07:12PM (#9691872) Homepage
    Well that makes it pretty worthless.. on a plus side if they sell it there's likely support and other features which would make php more of a option in business.

    Not really. Most people interested in compiled PHP are working in the "enterprise" market. $400 for a commercial compiler is not that bad.

    And if they can do it, why can't we... how long till GCC compiles php code?

    I think most people who have the skills to write something like a compiler generally want to make a living from their work, hence the $$. But, I agree it would be nice...

  • Dynamic languages? (Score:3, Interesting)

    by JessLeah ( 625838 ) on Tuesday July 13, 2004 @07:14PM (#9691884)
    What the heck does that mean? Is that a fancy way of saying "Compiled languages"? (I somehow doubt it) What precisely is meant here? Is a dynamic language "a language that can be either compiled or interpreted"?
  • by doe ( 64198 ) <edink@php.net> on Tuesday July 13, 2004 @07:23PM (#9691948)
    Roadsend is a development house unrelated to the PHP development team. I doubt that their compiler would make any noticable impact since they don't support many of the PHP's most useful extensions. I have not tested it but it looks to me that the people that would be interested in this are those that want to close source their own PHP code so I guess its only fair to pay for it.

    Many useful PHP tools are open source. From the bytecode compiles such as APC and MMCache, debuggers (APD and XDebug).

    I see tha fact that there are some companies out there providing commercial tools for PHP developers as a good thing(tm).
  • by LetterJ ( 3524 ) <j@wynia.org> on Tuesday July 13, 2004 @07:24PM (#9691954) Homepage
    If you use Windows and want to put your executable under GPL (the mmcache DLL has to be distributed with it), you can use <a href="http://www.priadoblender.com">PriadoBlender< /a>. It isn't technically compiling it, but you end up with a standalone EXE and the PHP code isn't in plain text. I'm currently working on a version of Priadoblender that uses the Bcompiler extension instead, which will remove the GPL requirement.
  • Re:$$ for compiler (Score:5, Interesting)

    by prockcore ( 543967 ) on Tuesday July 13, 2004 @07:25PM (#9691961)
    Uhm, the compiler is priced at a low, low introductory price of $399. I don't think it'll be taking the *NIX world by storm any time soon, or cause mass adoption to PHP executables anytime soon.

    The price is nothing. If you're running a site that requires compiled PHP, $399 is a joke. The thing holding the compiler back isn't the price, it's the lack of Solaris support.
  • by heyitsme ( 472683 ) on Tuesday July 13, 2004 @07:27PM (#9691971) Homepage
    Dynamic languages the future? Unlikely. The future of programming is more likely in code that isn't written, but rather "drawn"

    Many people haven't heard of LabView [ni.com], even though it has been around since the late 80s. It runs on Windows, Mac OS, and Linux. The premise behind LabView is there is no such thing as written code. Instead of code, applications are literally drawn by dragging variables (controls, indicators) onto the block diagram and wiring them together. For instance, if I wanted to add 1 and 2, I would create two integer objects with respective values, find the addition function, and wire them together to an output (indicator - think text box). I have written entire graphical application suites/analysis tools in a matter of days and weeks instead of months (had I written them in, say, C or Java or $your_texT_based_language_of_choice).

    The only issue many will have with LabView is that it is expensive. It is also closed source, but hey, so is Java. Anyone interested in rapid application prototyping/development or digital/analog instrumentation should check out LabView.

  • Re:Goodbye Perl? (Score:4, Interesting)

    by FyRE666 ( 263011 ) * on Tuesday July 13, 2004 @07:29PM (#9691980) Homepage
    I don't think there's much of a learning curve going from Perl to PHP - the other way there would be though! PHP closely resembles Perl in many ways - it has certainly been influenced by it to a greater extent than any other language I can think of.

    I've been using Perl for around 10(?) years and while I appreciate its regex engine is faster than PHP, and the CPAN modules offer things PHP doesn't have (at present), you can put almost any web app together far faster with PHP than Perl. IMV this also goes for most database driven shell scripts.
  • by drmike0099 ( 625308 ) on Tuesday July 13, 2004 @07:37PM (#9692032)
    There's certainly nothing wrong with this business model, although that's no reason to not be concerned about potential problems. As you said, they create a significant part of the core for PHP and make it open source and available for free, all of which is good. In a perfect world, this would be the perfect solution.

    However, it is right to be watchful (not necessarily concerned) when the core of an open-source app is created and driven by a for-profit company. Since they sell a lot of surrounding support applications to make their money, they are clearly driven at some level to pay for that development. At the very least, it means that any really good idea that they have will get turned into a commercial product instead of rolled into an open source solution. Again, perfectly fine business model, but not awesome.

    The other thing it does is that there is a subtle but probably powerful pressure pushing other developers working in the PHP space to consider not working there, because they will by definition start out behind this core company. It wouldn't hold off a determined company, but if a determined company began to come into the mix, it would be surprising if the core company didn't somehow use the fact that they are so essential to their advantage somehow. Without competition they can be magnanimous, but with it much less so.

    At any rate, I'm just pointing out that there's reason to keep an eye on it, even if nothing ever comes of it. It's also important to encourage more businesses to adopt this model so something as good as this can come along, and it's important for them to be watched by others to make sure they don't abuse it. The lessons of Microsoft, although in a different league entirely, are too strong to ignore.
  • Re:Goodbye Perl? (Score:3, Interesting)

    by xa0s ( 128789 ) on Tuesday July 13, 2004 @07:48PM (#9692138)
    I'm a longtime Perl programmer, and while I've seen Perl having been taken over by PHP on the web side of things, Perl still sees enourmous use in generic *nix system world. For example, in the company I work for we use many programming languages on many architectures, and Perl has consistently been the duct tape that ties them all together. We even have a dedicated infratructure team that maintains the various releases of Perl and our core Perl APIs. I dont think Perl will ever completely die(), but it's use in certain areas has certainly diminished.

    Although I haven't done much more than quick hacks to PHP scripts, I still prefer to use Perl for everything. Every time I've tried to seriously use PHP for web stuff, I always go back. I end up missing the syntax, idioms and CPAN. I suppose its just a matter of personal taste.
  • Unicode Any Better? (Score:3, Interesting)

    by ThatDamnMurphyGuy ( 109869 ) on Tuesday July 13, 2004 @07:55PM (#9692206) Homepage

    PHP is dead. Long live PHP!

    Now that I have that out of my system. Does anyone know if PHP5 Unicode is any better than PHP4?

    Admittedly I've done about 10 total minutes of PHP coding in my entire life, but I do follow it as closely as possible when I'm not thinking about Perl. I always got the impression the Unicode working in PHP4 was a little lacking compared to the latter versions of Perl.

    For example: PHP does have limited unicode support [randomchaos.com] and Joel on Software [joelonsoftware.com].

  • by ShadeARG ( 306487 ) on Tuesday July 13, 2004 @08:02PM (#9692255)
    The products they produce to support the development of php the closed source.
    This is part of the problem. While this isn't in itself a terrible practice, it does leave esoteric developers who prefer other [wikipedia.org] different [wikipedia.org] architectures [wikipedia.org] out in the cold.
    There is nothing wrong with this business model, get over it.
    Exactly. It's not that we always want free beer, we just like to make sure that we can drink as much as everyone else. Now, if you could request a cross-compilation for a different architecture at no additional cost with the license, then we'd all be impressed.
  • by Theovon ( 109752 ) on Tuesday July 13, 2004 @08:16PM (#9692350)
    This makes me wonder if the PHP programs have to be manually compiled, if they can be compiled JIT, or if a compiled version can be cached and only recompiled if the original PHP source changes....
  • Re:Goodbye Perl? (Score:3, Interesting)

    by LetterJ ( 3524 ) <j@wynia.org> on Tuesday July 13, 2004 @08:16PM (#9692358) Homepage
    I do an *awful* lot of commandline scripting and have an experimental demo of doing PHP with HTA's as a GUI, giving you PHP without a web server, but with a GUI and still using HTML as the GUI language. It's actually pretty slick. You can build HTML forms that are processed by PHP scripts just like they would going through a web server, but run on the commandline instead. It emulates POST and I'm working on emulating XML-RPC next. I'm calling it PHUI (PHP HTA UI) toolkit.
  • by LoveMe2Times ( 416048 ) on Tuesday July 13, 2004 @08:34PM (#9692491) Homepage Journal
    Not to be flaimbait (really!), but after reading over the new features in PHP 5, my reaction is, "you mean you haven't had this all along?" Sure, all this is great for existing PHP users, but I don't think users of other languages will care much. New XML support? Now you can define constructors with __constructor() instead of the name of the class!!! Umm... Try/Catch? Overall, it seems they're just Java-fying PHP, in which case you might as well use Java, so it seems to me (unless, of course, you are already a PHP programmer). Perl programmers will just keep waiting for Perl 6, which makes these "new" features seem kinda like your 6 year old nephew threating to kick your ass. People who are looking for a new, hip, language all seem to be going for Ruby, and I can't blame them (heck, I would too if I had time for such things). Hey, can you hold on a sec... 1999 just called, they want their features back...
  • by markv242 ( 622209 ) on Tuesday July 13, 2004 @08:37PM (#9692515)
    Seriously, I'm looking at http://www.php.net/zend-engine-2.php and all that the eye can see is a nearly-identical syntax to Java. Classes, object cloning, Throwables, destructors, exceptions (albeit weak ones), statics... holy crap people, why not just switch to Java? It's all that PHP5 has and more.

    (Hurray for being modded as flamebait!)

  • by bobsledbob ( 315580 ) on Tuesday July 13, 2004 @09:03PM (#9692711)
    With your reasoning, there's reasons to be concerned about every open source software except those created in the basements of college dorms.

    Frankly, I don't disagree with you. You should be mindful of every piece of software you use, open or otherwise. But, your argument seems more about Karma Whoring than it does a real concern.

    I mean, seriously, what about the Apache Foundation? Where do you think they get their money from? Corporations using their products, right? Don't think they're influenced by said corporations?

    I frankly an very supportive of the Zend model of creating a business around open source. It's very pioneering, they've done a good job. I've used php since the PHP/FI (v2) iterations, and I'm still happy to continue using it.

  • Re:Goodbye Perl? (Score:4, Interesting)

    by MourningBlade ( 182180 ) on Tuesday July 13, 2004 @09:14PM (#9692791) Homepage

    Of course, she could be like Oracle, where she knows you're not doing it right, but has no suggestions whatsoever on where the problem might lie or how to fix it.

    Perl can be difficult to debug. It's one of those "wide or deep" questions: you can have an extremely simple syntax, and require a ton of code to describe what you mean to do, or you can have a rich syntax and say it more succinctly (even more descriptively, given skill on the part of the writer and the reader).

    All languages are a tradeoff. Glad PHP is where you want to be on that spectrum.

  • Thread Safe yet? (Score:2, Interesting)

    by bmzf ( 731840 ) on Tuesday July 13, 2004 @09:38PM (#9692939)
    Is php 5 thread safe? More specifically, is it safe to use in a production environment with Apache 2?
  • Re:Goodbye Perl? (Score:4, Interesting)

    by senzafine ( 630873 ) on Tuesday July 13, 2004 @09:41PM (#9692952) Homepage
    At my work we develop alot in PHP. Me and another co-worker started creating a repository of classes which we use like there's no tomorrow. We've gotten a really good system of consistent coding style. Though I can still tell what lines he's written and I've written. But they're formatted the same so a third developer can come in and understand it all as well.

    As far as PHP for shell scripting. I use it when I just need something quick. I'll sometimes go back and change it to a different language when I have time.

    To make a long post short...I'm estatic about php5 being released!
  • SOAP (Score:3, Interesting)

    by Tobias Luetke ( 707936 ) * on Tuesday July 13, 2004 @09:54PM (#9693050)
    Its definatly an awesome release. I'm thrilled by the native SOAP support.
    Hard to imagine what the OS crowd will do with a blockbuster feature like this generally available. SQLite will improve the xcopy deployment compatibilities of simpler apps and SimpleXML is the best xml API i have seen so far in any language. On the OOP front we get exceptions which will finally unmangle the error systems of most complex php web apps which usually accounted for a big chunk of the code.

    Anyways, php is cutting edge again.
  • by Anonymous Coward on Tuesday July 13, 2004 @10:05PM (#9693123)
    Ruby is basically a superset of Python and Perl.

    If you've ever been programming Python and wished it was cleaner and less "arbitrarily verbose", you'd like Ruby. If you wonder why Python arbitrarily makes you say "len(str)" instead of "str.len()", you'll like Ruby. If you wonder why Python makes you type "def foo(self)" instead of just "def foo", you'll like Ruby. If you wonder why you should type verbose hard-to-read stuff like "[f for f in n if f < 4]" instead of something like "n.each { |f| f<4 }", the give Ruby a whirl.

    If you ever programmed Perl and wished it had an actual object model, so you don't have to do stuff like "UNIVERSAL::isa($val, 'FooClass')", but can just treat each variable the exact same way like "foo.kind_of? Integer" you'll like Ruby. If you hate how Perl lets you make objects that are hashrefs OR arrayrefs OR scalarrefs, making extension of existing classes utter madness, you'll like Ruby.

    If you like adding your own methods to base types like Arrays, Hashes, Integers, etc., you'll just go nuts with Ruby.

    If you like distributed programming you'll get a kick out of DRb (comes with Ruby).

    Do you need extended your languages with external C libraries? You will positively, absolutely shit yourself three times when you try out Ruby/DL, which lets you extend Ruby with arbitrary C libraries at run time without any compiling or setup.

    If you wonder why Java takes 3-5 lines of code just to parse an XML file or set up a loop you will find Ruby quite a change. And REXML is the most lightweight easy to use XML parser I've ever used (PHP5's new parser comes *close*.. but PHP is not Ruby).

    If you like writing code FAST without worrying about heavy syntax or arbitrary design choices, you'll like Ruby. If you like passing anonymous code blocks to your functions like SmallTalk, you'll get a kick out of Ruby (and if you don't do that, learn, it will make your programs tighter). If you are into agile programming and merciless refactoring, you'll like Ruby (unless you are a lover of lisp macros, then you'll find Ruby blocks a little limiting, can't help you there).

    If you use a Mac you'll like it because Ruby is pre-installed.

    If you do MVC-type web apps, your mouth will hang open when you use the highly dynamic Ruby on Rails (how do you add a new object to your app when you add a new database table? ONE LINE OF CODE. How do you add a new field to your object when you add a new column to the database? DO NOTHING.)

    Ruby is the only language I can say with a straight face is "beautiful" AND useful.

    So unlearn a couple of those languages and try Ruby! ;-)
  • Re:So it is out... (Score:3, Interesting)

    by maxdamage ( 615250 ) on Tuesday July 13, 2004 @10:40PM (#9693321) Journal
    Me for one. My site [zapto.org] is now running it!
  • Re:Goodbye Perl? (Score:1, Interesting)

    by Anonymous Coward on Tuesday July 13, 2004 @10:41PM (#9693324)
    So why does slashdot keep advertising for commercial companies again?
  • Re:Goodbye Perl? (Score:5, Interesting)

    by blankslate ( 748549 ) on Tuesday July 13, 2004 @10:54PM (#9693387)
    I'm surprised with all this PHP vs PERL talk that no-one's mentioned that ZEND says [zend.com] you can use PERL from within PHP, as of release 5. Does no-one else find this highly interesting? Anyone tried it yet?
  • by FoboldFKY ( 785255 ) on Tuesday July 13, 2004 @11:21PM (#9693506)

    ...but for some reason I'm rather disinterested.

    Don't get me wrong; I've been doing PHP coding for a while. But the fact of the matter is that the more I code in PHP, the more I dislike it.

    Granted, the new OOP features in PHP5 are a good thing; hell, they should've been in there a LONG time ago. And exception support has me jumping for joy.

    But where for the love of all that is holy is support for namespaces? I mean, sure PHP has a ton of really handy extensions, but I am getting so sick to death with typing underscores that I'll be happy man if the world suddenly decided that underscores were bad and removed them from all character sets (oh, and keyboards) entirely.

    And I've also come to the conclusion that the standard PHP api can't quite make up it's mind whether it's supposed to be emulating C, or maybe some other language. Some array functions are prefixed by array_. Some aren't. Some have their arguments in the reverse order that almost all the others do. It's a mess.

    PHP is a nice language, good for beginners. But it's complete lack of namespaces, half-arsed support for functional constructs (damn I hate having to write callback functions out seperately when they're one liners!), and schizophrenic api are slowly pushing me towards more well thought-out languages like Python.

    Sure, Python's "thou shalt indent" system annoys me a lot of the time, but other then that it's just a clean, logical language. Unfortunetly, support for it on web hosts seems to be all but non-existant.

    Seriously, if the PHP devs really want to bring PHP up a few notches, they need namespaces, and to standardize the API naming conventions. I shouldn't have to constantly open up the PHP manual to work out whether the array sorting function has array_ out the front or not.

    Still, it's a nice set of improvements, so credit where credit is due. Kudos to the PHP team.

  • by ThisIsFred ( 705426 ) on Wednesday July 14, 2004 @01:09AM (#9694116) Journal
    Considering the problems with the shelf life of various recordable optical storage, that may be where we all end up!
  • dynamic languages (Score:3, Interesting)

    by dekeji ( 784080 ) on Wednesday July 14, 2004 @01:38AM (#9694226)
    Benchmarks say that performance is pretty good. Is this another sign that dynamic languages are the future?"

    No more and no less so than they have ever been: dynamic languages are a good choice for many, but not all applications. And dynamic languages have been enormously popular for decades, with far programmers using them than using static languages; PHP just follows in that tradition.

    What is more interesting is the emergence of dynamic languages which use static type systems by default: in their runtimes, Java and C# have more complete and better defined dynamic features than Lisp, but they still give the user a simple static type system by default. It remains to be seen whether that gives you the best of both worlds or the worst. Fortunately, their runtimes are well-defined enough that one isn't limited to the specific choices that the currently popular languages running on top of them have made.
  • Re:Goodbye Perl? (Score:3, Interesting)

    by fucksl4shd0t ( 630000 ) on Wednesday July 14, 2004 @03:38AM (#9694633) Homepage Journal

    If you properly abstracted your db layer in the first place, then you're safe to use mysql_* without having to worry about rewriting large sections of your code later.

    Pet peeve: all these open source PHP applications that embed every single fucking query right where they use it. Inheritance works great for this, and I've got an object model put together that solves this problem nicely. Two classes, one that you derive from. That one you call for your data, whatever you need. It (dbPage or dbCategory, depending on what it is, you have to write this one, it's not generic) calls dbBase->Query for the data you requested. dbBase returns true on success, or an error on failure. On success it stores the results in a member, which you then dbBase->Results to get. dbBase also manages the connection and so forth.

    Later on, when I want to migrate to another database, I only have to rewrite *one* class, and PHP happens to provide a number of nice features that'll let me choose which version of the class to use at runtime. And even then, I don't have to rewrite the whole class, just three core methods, all of the others of which are just error-handling based on results from those methods.

    Really, there's very little excuse in this day and age for having to rewrite large portions of your code just because your database changed. Don't we all have some generic db abstractors laying around in our pet languages by now? I've got 'em for php and python (the only languages I use anymore).

  • by dotnetwolf2003 ( 778868 ) on Wednesday July 14, 2004 @04:31AM (#9694795)
    Lucky PHP guys.. Too bad that support for compiling Perl code into executables is almost non-working.. The only viable alternative I know of is using Stunnix Perl-Obfus [stunnix.com] for obfuscation/scrambling, and turning output into executable with PAR [perl.org] or Perl2Exe. Does anybody knows a better alternative?
  • debugging (Score:3, Interesting)

    by mgkimsal2 ( 200677 ) on Wednesday July 14, 2004 @07:58AM (#9695359) Homepage
    If memory serves, PHP3 had built-in debugging output capabilities. When Zend became 'official' and PHP4 was released, debugging was suddenly nowhere to be found. BUT, lo and behold, you can get debugging capabilities if you purchase the Zend Studio and server extensions. Yes, there are open source debugging extensions now too, but that move was the one that made me start thinking like you're doing. Again, nothing inherently WRONG with it, but it was something that seemed to be held out of the core system to help fund the development by selling it separately.
  • by WWWWolf ( 2428 ) <wwwwolf@iki.fi> on Wednesday July 14, 2004 @08:18AM (#9695444) Homepage

    Have they fixed the most annoying thing about PHP4? Specifically, if I put <?xml version="1.0" encoding="iso-8859-1"?> quite normally outside of PHP code, PHP4 barfs. (Which is quite annoying if the recommended way to put PHP code in is to use <?php ... ?<, specifically for XML/XHTML compliance. A savage hypocrisy.) And before you ask, no, I can't mess around with PHP configuration or anything.

    Also, what about componentization? Any news on that front? I'm quite fond of Perl's HTML::Mason and sort of like JSP tag library ideas - can I clearly separate the code and the page, or do I still need to mess them together?

    News of a new XML parser sound good, though. PHP4's idea of XML parsing is... ugly. =)

  • Re:So it is out... (Score:2, Interesting)

    by Kosgrove ( 75723 ) <jkodroff@noSpAm.mail.com> on Wednesday July 14, 2004 @09:46AM (#9696159)
    Let me preface this by saying that I take a moderate stance in the Windows/Linux never-ending holy war and while I haven't developed extensively in PHP or ASP, I think I have a decent grip on the capabilities of both.

    I found ASP MUCH easier to read. It's at least pseudo-OO. There's a reason why Visual Basic (and VBScript-based ASP) is so incredibly popular, even besides the prevalence of MS' operating systems: it's VERY well designed and very readable.

    Now, throw in ASP.NET, (which admittedly is a whole different language) and its compiled (rather than interpreted) pages and you've got a much better (IMHO) language. Also, the Interdev IDE is far better than any IDE I've seen for PHP. (Not that one doesn't exist - I just haven't seen one.)

    That said, I've found that PHP as a shell scripting language (In Linux of course) has allowed me to accomplish some system administration tasks that would've taken me forever using BASH scripting (because I know very very little).
  • by scrytch ( 9198 ) <chuck@myrealbox.com> on Wednesday July 14, 2004 @10:25AM (#9696557)
    I remember putting a CMS together with PHP4, something like Midgard, but pure PHP with multiple backends. It's not entirely a bad design even now, though I think Zope has a better answer.

    I ran into some awesomely dumb stuff. I mean "what are they smoking" stuff.

    Brain dead parser: First of all, this requirement to put everything in tags or whatever brackets you have defined. What is this, javascript? (and even javascript doesn't need it if you use src="foo.js"). That alone, not so bad, but the parser would easily choke on any end bracket construct ANYWHERE -- in a string, in a comment, etc.

    Flat namespace. OOP completely unused in extensions. Since PHP can easily call functions dynamically by name, and we have PEAR now, I consider the problem solved. No worse a hack than perl's OOP implementation, really. But I had other problems with OOP...

    Pass-by-value: PHP4 would pass objects by value. Which is actually great if I want such value-type, but 99.9% of the time, I don't. What made matters worse was PHP's twisted notion of object identity -- it had no operator to test it. Equality comparison operators were always by value, and either "shallow" or "deep". I had to explain the concept of object identity, and for my trouble, got the '===' operator ... which did exactly the WRONG thing and implemented even DEEPER comparison. That was the point where I went over the edge and wrote off PHP. I hear this behavior has mercifully changed to a sane one in PHP5.

    Second-class-language attitude: I got choice responses from Zeev himself about how PHP is never intended to be more than a "web language" (apparently meaning limited to trivial scripting, because the web apps I use sure aren't trivial). PHP can be and has been used for powerful things, but I don't see writing a caching bulk DNS lookup service that tests against multiple RBL's using PHP if I can't get a serious contender to Net::DNS because PHP is "merely a web language" after all. I used Perl for that, then switched it to Python (stackless was ideal for this job) and then dropped it into the object publisher in mod_python. Painless. There is no such thing as a "web language", behind every web app there should be a *real* language.

    Error handling: Nonexistent. Got an error, it would print a traceback to the output if you were lucky. Syntax errors would simply die without any useful diagnostic. No eval (well there is, but it would also just die on syntax errors). I've seen structured exceptions in C, but PHP's was awful. Awesomely brittle.

    Hopefully PHP5 is migrating most of these warts away from PHP4. Perl certainly still has its own problems (mod_perl 2.0 is still not in a stable release state) so it's not too late for PHP among current perl users.
  • by Anonymous Coward on Wednesday July 14, 2004 @10:58AM (#9696869)
    If you need decent Unicode support, don't try Ruby, 'cos it's author arbitrarily dislikes Unicode and refuses to implement it. Hint: you probably either do need it or will do soon.

    If you want your programs to run at a decent speed, don't try Ruby, because for the amount of money you'd have to spend on hardware fast enough to run Ruby at anything above a toe-curling crawl, you could afford to hire so many extra programmers that they could write your code in hand-tuned ASM just as quickly as you can write it now in PHP.

    At this point I'm supposed to round out the post by recommending Lisp or Smalltalk over their bastard offspring, but I can't be bothered.

You knew the job was dangerous when you took it, Fred. -- Superchicken

Working...