Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



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:
  • Thanks PHP team (Score:3, Informative)

    by Dreadlord ( 671979 ) on Tuesday July 13, 2004 @06:47PM (#9691698) Journal
    Doing PHP development has been my main source of income for a couple of years, the new release will make my life much easier, especially the new OOP model, let's just hope that web hosts will upgrade soon.

    Thanks again PHP team!
  • by andig ( 139527 ) on Tuesday July 13, 2004 @06:53PM (#9691743)
    One of our design goals for PHP 5, was to keep backwards compatibility as much as possible. Actually most PHP 4 sites run out of the box with PHP 5. If there are problems, there's a compatibility mode (configurable via php.ini) which makes the object-oriented model behave the same as in PHP 4.
    Bottom-line: Very few people will have problems doing the upgrade. Of course you should thoroughly test your site before upgrading.
  • Re:Cross Platform? (Score:5, Informative)

    by Dreadlord ( 671979 ) on Tuesday July 13, 2004 @06:54PM (#9691756) Journal
    Yes the official interpreter is cross-platform, it is available for *nix and Windows.

    Check out the downloads section [php.net] at php.net for Windows binaries and *nix source, and here [apple.com] you can find more details on PHP under Mac OS X.

    As for the compiler in the story, I haven't tried it before so I don't know.
  • by MisterJones ( 751585 ) on Tuesday July 13, 2004 @06:54PM (#9691761)
    http://www.roadsend.com/home/index.php?pageID=faq

    $400 for the license, which is only good for one year. After that, it won't compile until you renew.

    Doesn't seem worth it for the casual hobbyist...
  • Re:PHP Compiler (Score:4, Informative)

    by KevinKnSC ( 744603 ) * on Tuesday July 13, 2004 @07:02PM (#9691813)
    From the site:

    The compiler generates binary code that is executed directly by the CPU, avoiding the intermediate process of compiling to bytecode and running in a virtual machine

    That's a true native compiler to me.

  • by z0ink ( 572154 ) on Tuesday July 13, 2004 @07:05PM (#9691834)
    For those who are not new to php, but wan't a good primer for PHP 5 I would definatly recommend this book [amazon.com] by George Schlossnagle. Advanced PHP Programming was recently reviewed here [slashdot.org] and it was upon reading that review that I decided to pick up a copy. It serves as an introduction to OOP to those who are unfamiliar and does a good job in covering the specific mechanics of how things operate in PHP. The book even includes some good info on some Zend Engine hacking.
  • Re:$$ for compiler (Score:3, Informative)

    by NoMercy ( 105420 ) on Tuesday July 13, 2004 @07:05PM (#9691835)
    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.

    And if they can do it, why can't we... how long till GCC compiles php code?
  • Re:Goodbye Perl? (Score:5, Informative)

    by Tyler Eaves ( 344284 ) on Tuesday July 13, 2004 @07:09PM (#9691854)
    Any decent language has full PCRE support these days. Perls days as regular expression king are in the past. Sure it may have set the standard for how it's done, but now it's no longer a selling point. Plenty of other nicer [rubylang.org] languages [python.org] exist. [php.net]
  • by cyberlotnet ( 182742 ) on Tuesday July 13, 2004 @07:09PM (#9691857) Homepage Journal
    PHP itself including the zend engine is 100% opensource, You can download the source you can browse the cvs to your hearts content and see everything.

    The products they produce to support the development of php the closed source.

    You do not need to touch, use or otherwise dirty your poor soul with any "non-free" software to use php.

    There is nothing wrong with this business model, get over it.
  • IonCube (Score:3, Informative)

    by JohnnyBigodes ( 609498 ) <morphine@@@digitalmente...net> on Tuesday July 13, 2004 @07:11PM (#9691868)
    Speaking of PHP compilers, there's a good and very affordable solution from IonCube [ioncube.com] as well.

    (no, I have no affiliation to them)
  • PHP 5 Tutorials (Score:4, Informative)

    by aint ( 183045 ) on Tuesday July 13, 2004 @07:17PM (#9691912)
    For a list of PHP 5 related tutorials and articles check out this faqt [faqts.com] or simply look around the faqts PHP 5 section [faqts.com].
  • Re:Cross Platform? (Score:4, Informative)

    by man_ls ( 248470 ) on Tuesday July 13, 2004 @07:20PM (#9691924)
    Very cross-platform...obviously some things like file paths might have to be changed to reflect the filesystem they run on top of (/usr/bin/whatever vs c:\program files\whatever) but with few exceptions, PHP code written on any OS will work on any other one.
  • by andig ( 139527 ) on Tuesday July 13, 2004 @07:20PM (#9691925)
    If you'd like to see what's new in PHP 5, we got some of the leading PHP developers to write about new extensions they developed.
    I also posted the first chapter of my PHP 5 book in that section which gives an overview of what's new in PHP 5. This book will be part of the Bruce Perens series of Prentice-Hall and will therefore be open-source and freely accessible to anyone.
  • by Animats ( 122034 ) on Tuesday July 13, 2004 @07:24PM (#9691958) Homepage
    LISP is a good match for operating on HTML and XML, both of which are really tree structures. Operating on trees works very well in LISP. That's what it's good at. Perl, PHP, and Java don't do trees well. You have to hammer the tree into an object paradigm, which doesn't help all that much. Perl's representation of a tree is rather inefficient, too. I do considerable parsing of large documents into trees in Perl. It works, it's portable, it's slow, and Perl is badly matched to the task. PHP is worse.

    LISP's parentheses turn everybody off, including me, but the data structures really are a win for tree-like applications.

  • by Sokie ( 60732 ) <jesse AT edgefactor DOT com> on Tuesday July 13, 2004 @07:34PM (#9692009)
    A kind of slick way to test your existing code and applications is to do a little <IfDefine>-fu in your apache.conf and set it up so you have two instances of Apache running on different ports but using the same DocumentRoot. One instance running the PHP4 module and one the PHP5 module. I've got this set up on my Gentoo dev server with PHP5 running over port 8080. Just add an :8080 to the URL and your page is running through PHP5, I've found it quite useful for playing around and testing. If anyone wants more details just e-mail me. And if you're not using Apache, you can probably set up a similar thing, but I can't really help you there.
  • by Waffle Iron ( 339739 ) on Tuesday July 13, 2004 @07:41PM (#9692071)
    Dynamic language usually means "dynamically typed". This means a typed language that associates type information with data values, not with variables. (i.e, the language keeps track of types, but any variable can hold a value of any type)

    Sometimes, it also implies things like dynamically extensible type definitions at runtime, automatic memory management, and support for various functional-style features such as closures.

    Compiling a dynamic language to machine code is usually a challenging problem.

  • Re:Compatible? (Score:3, Informative)

    by Jellybob ( 597204 ) on Tuesday July 13, 2004 @07:47PM (#9692128) Journal
    In almost all cases PHP4 code will run fine under PHP5.

    The only situations where you're likely to hit problems are in reassigning $this in OO code, for example if you had constructors which would go

    $this = new My_Error_Class();

    Which is no longer supported.
  • by RazzleFrog ( 537054 ) on Tuesday July 13, 2004 @07:53PM (#9692187)
    I would normally agree with you but the testing on PHP 5 has been so extensive and has gone on for so long (2 or 3 Betas and 3 RC's) that I am pretty confident in it. I have been using it since Beta 2 and I haven't had any problems with it. Premature releases are so ingrained into our mentality that we sometimes forget that there are quality developers out there who do do thorough testing.
  • OS X? (Score:2, Informative)

    by HitByASquirrel ( 710289 ) on Tuesday July 13, 2004 @08:06PM (#9692281)
    I guess those of us who do not know how to make our own binaries just have to wait for Marc Liyanage [entropy.ch] to port this thing.

    thanks Marc.

    I cant wait to play with the final XML/DOM-3 libs.
  • I hate to say it.... (Score:3, Informative)

    by Anonymous Coward on Tuesday July 13, 2004 @08:12PM (#9692321)
    ...but Microsoft really did get there lightyears ahead of this, with a far more complete class library and a standardized language, as well as a scripting engine that supported true seperation of code, presentation and so forth.

    Just to clarify this, consider the following:- ASP.net's been precompiled since the 2000 beta, and it's been production ready for years. The C# language is also fully documented and is a public standard ratified by the EMCA.

    PHP5, however nice, is treading old water, and in terms of functionality is still lagging behind even Java/JSP. The whole reason I'm assuming people stuck with PHP4, rather than move to something more robust that provides this kind of capability, is that:-

    1) They're apathetic about new technology.
    2) If the old language does what they want, why upgrade. It's *Personal* Home Page, after all, not corporate homepage.
    3) Why make things more complex, for very little benifit.

    Performance wise, the compiled version advantages are fairly insubstantial, and 99.9% of the new stuff they've added could have been done in other ways using the existing language.

    The whole thing seems pretty stagnant, and I'm guessing there's a small chance that the PHP guys are stuggling to find their own space between the land of true pre-compiled OO languages and the interperated world that lay behind it.

    I've worked with PHP4 and ASP.net since both of them were betas, and if PHP wants to be a serious consideration for large scale development, it'd better decide which side of the OO fence its on, and stay there.
  • by Distinguished Hero ( 618385 ) on Tuesday July 13, 2004 @08:19PM (#9692376) Homepage
    Have you looked at Ruby [rubycentral.com]? Regular expressions are very well integrated, and it seems like a far more elegant language (to me).
  • Re:Goodbye Perl? (Score:2, Informative)

    by metasyntactic ( 322999 ) on Tuesday July 13, 2004 @08:45PM (#9692580)
    Microsoft makes all its compilers available for free. You can find them all at http://msdn.microsoft.com [microsoft.com]

    -- Cyrus (http://blogs.msdn.com/cyrusn [msdn.com])
  • Re:Goodbye Perl? (Score:2, Informative)

    by jswhiting ( 748371 ) on Tuesday July 13, 2004 @08:46PM (#9692583)
    zend is offering a package [zend.com] that includes the zend accelerator, studio, & encoder for $295 or $450 with upgrades/bells/whistles per year, as long as your company is pulling in less than 100k per year.

    i dont work for zend; i bought the package (think its a good deal).

    if you insist on free software, there are a number of free php code caching apps as well as development ides available...
  • by apia ( 662445 ) on Tuesday July 13, 2004 @08:48PM (#9692600)
    I use PHP to develop a p2p application (CLI mode), the project name is called "apia", I develop it for more than two years.

    In my experience, the memory management in PHP is not good. Coding should be very careful, or the memory will be usually exhausted.

    Another problem is the speed. Well, it is inevitable that interpreter execution is slow. However, I think PHP can run at least twice than current version if the inner architecture of PHP could be carefully rewritten.

    Additional, I hope PHP could be multithreaded. When develop a serious application, multithreading or multitask can help programmer lots. And also the efficiency of application could be higher.

    I hope these problems could be solved in PHP 5 or later versions.

    If you are interested in apia, check : http://clonefab.net/, but there is no English web site yet, sorry for this. It is developed in Chinese language initially. The English document will be ready ASAP. As for apia package itself already support english. You can download it in : http://clonefab.net/apiaDownload.php

  • Re:IonCube (Score:3, Informative)

    by mdfst13 ( 664665 ) on Tuesday July 13, 2004 @09:01PM (#9692702)
    That's not a compiler in the same sense; it's an encoder. It allows people to store PHP scripts as a proprietary code (it's actually a lot like java). A true compiler creates native machine code.
  • by andig ( 139527 ) on Tuesday July 13, 2004 @09:07PM (#9692738)
    Yes I can confirm. We, as in Zend, are working with Sun on the JSR 223. The result will be a Sun reference implementation of the standard (based on PHP) which defines what the interface between PHP (and other scripting languages) and Java will look like.
  • Re:Goodbye Perl? (Score:2, Informative)

    by scrame ( 767779 ) on Tuesday July 13, 2004 @09:28PM (#9692871) Homepage Journal
    Yep. All the Visual Studio 2005 betas are free here [microsoft.com]

    and also Creative Expression [microsoft.com]

  • by brlewis ( 214632 ) on Tuesday July 13, 2004 @09:34PM (#9692916) Homepage
    A lot of folks have no problem migrating from f(a, b) to (f a b). In fact, a lot of people don't find the migration from 2+2 to (+ 2 2) all that hard. I use Scheme all the time and like it.
  • Re:Thread Safe yet? (Score:5, Informative)

    by andig ( 139527 ) on Tuesday July 13, 2004 @09:42PM (#9692961)
    The problem isn't the core of PHP, but the dozens of PHP extensions and third-party libraries they use. Even if a library claims thread-safety, it is not always so. Therefore, we (as in the PHP development team) recommend to use PHP with the pre-fork MPM of Apache 2 or with Apache 1.3.
  • by a_karbon_devel_005 ( 733886 ) on Tuesday July 13, 2004 @09:47PM (#9692989)
    Just to clarify this, consider the following:- ASP.net's been precompiled since the 2000 beta, and it's been production ready for years. The C# language is also fully documented and is a public standard ratified by the EMCA.

    ASP.NET is a completely different class of thing. Of course it's been pre-compiled, because just like the other .NET languages, it gets turned in to MS's CLR, which is of course a byte-soup. PHP is not compiled at all, which makes it more flexible to develop... no compile time, just write-test-write-test-write-test ad nauseum.

    There's no real advantage in compiling most PHP code because the life cycle of a script is so short, compiling really wouldn't make much difference. If you're going to be doing so much processing with a script that it requires compiling most people have either:

    1) written the script in another language
    2) compiled some C code and then exposed it to the PHP interpreter (using swig or somesuch).

    But the issue doesn't come up that often because if you're writing things well, php is usually fast enough.

    The whole thing seems pretty stagnant, and I'm guessing there's a small chance that the PHP guys are stuggling to find their own space between the land of true pre-compiled OO languages and the interperated world that lay behind it.

    Stagnant? Have you seen the RAW amount of libraries available for PHP? Have you seen the language changes that have been going on for 5? Obviously not. You're spewing marketing BS with no knowledge.

    1) Modules are constantly written for PHP because it's such a simple language to extend.
    2) The changes in 5 are very significant for those who actually have to USE PHP, and that should be apparent to ANYONE who takes time to read the changelog.


    I don't know where you come up with "stagnant" other than what it "feels like" to you.

    PHP5, however nice, is treading old water, and in terms of functionality is still lagging behind even Java/JSP.

    Examples Mr. ASP? Sounds like more marketing style bs. Post some examples. ( and watch them be refuted in no time flat )

    I've worked with PHP4 and ASP.net since both of them were betas, and if PHP wants to be a serious consideration for large scale development, it'd better decide which side of the OO fence its on, and stay there.

    1) Why the fuck work with ASP.NET when C# is out there?
    2) As much smarter people out there have commented, there is not necessarily a correlation between OO and "scaleability".

    ...but Microsoft really did get there lightyears ahead of this, with a far more complete class library

    Just because PHP doesn't have a large "class library" doesn't mean that it's immense functional library is irrelevant. Far from it.

    The whole reason I'm assuming people stuck with PHP4, rather than move to something more robust that provides this kind of capability, is that:

    Care to mention WHAT kind of capabilities you're talking about?

    Personally I think PHP is good for a great many things, though I like other languages like Python, C#, C++, and Java better for my own stuff. Why don't you post some specific examples though instead of just getting a woody for ASP.NET?
  • Re:Goodbye Perl? (Score:2, Informative)

    by a_karbon_devel_005 ( 733886 ) on Tuesday July 13, 2004 @10:00PM (#9693084)
    I eat hat now.

    Yes I do use preg_match() quite often, but apparently I've never needed to match a backslash. I humbly apologize, and realize you are correct.

    HOWEVER, other than that I can't think of anything too hard about the quoting style of PHP. You've got interpolated, non interpolated, and HEREDOC. *shrug*
  • by base_chakra ( 230686 ) on Tuesday July 13, 2004 @10:23PM (#9693219)
    why not just switch to Java? It's all that PHP5 has and more.

    Except for speed. :)
  • Re:Compatible? (Score:5, Informative)

    by Trifthen ( 40989 ) on Tuesday July 13, 2004 @11:33PM (#9693594) Homepage
    Uh... no. They also changed the object inheritance rules so that overloaded child methods have to have the exact same number of parameters as the original class. So, now you can't have multiple constructors *or* have child constructors that assume certain values and reduce the amount of paramters accordingly.

    Yuck.

    As a person who codes entire 20,000+ line application libraries in PHP and has been watching the development of PHP 5 very closely, there are a lot of decisions the PHP developers have made that make me very hesitant about going anywhere near the new PHP version.

    As an aside, the PHP developers have decided to make SQLite, a light file-based database engine, the default session handler. Even with all file locking turned off, this is at least 4 times slower than the current system used by PHP 4. Of course you can change this setting back to flat session files, but the fact this is their default should say something about other decisions they've made. This setting itself makes especially no sense to me, as all session variables go into the $_SESSION superglobal as associative array keys - there is absolutely no benefit to using a database-enabled flat file for this, as opposed to a regular flat file. It's as if the PHP group were excited about sqlite and tried shoving it into everything.

    Just read the changelog very carefully. If you're already using PHP, and have gone deeper than casual use, your applications *will* break - especially if you turn on PHP's strict mode which kills backwards compatibility with PHP 4.
  • by Anonymous Coward on Tuesday July 13, 2004 @11:43PM (#9693658)
    Static/dynamic dictates whether the typing happens at parse/compile time or at run time. Weak/strong dictates what to do when small type-mismatches arise. C is the classic (mostly) weakly-typed language. You can do "double x = int_variable;". You can do "void *blah = &int_variable;". You can do all sorts of crazy stuff.

    Here's a handy table:
    Dynamic/weak: PHP
    Dynamic/strong: LISP
    Static/weak: C
    Static/strong: Haskell

  • In a really simplified explanation:
    Strongly typed - the identifier is typed
    Dynamicly typed - the data (object) is typed
    Weakly typed - the operations on the data are typed
  • PHP and Unicode (Score:3, Informative)

    by UnConeD ( 576155 ) on Wednesday July 14, 2004 @12:27AM (#9693941)
    The basic summary is, PHP does not support Unicode or any other encodings properly. PHP strings are 8-bit-per-character and do not have any explicit encoding. Sure, there is a multibyte string extension available, but when you look at the big picture, it's worthless.

    The reason is that PHP's biggest strength is that these days, you can get a PHP-enabled host for virtually no money. However, most of these installs run a standard PHP, some even a locked down one.

    The consequence is that anyone who wants to develop PHP software for a large audience cannot use any non-standard stuff (except /maybe/ the popular graphical extensions like GDlib). Which means that for those developers, PHP does not do Unicode at all.

    I don't see why they won't do native Unicode, when Perl, Python, Java and all the other popular web languages support Unicode with all the bells and whistles.
  • by Anonymous Coward on Wednesday July 14, 2004 @12:47AM (#9694035)
    I could be way off since it's been a while, but if I recall correcly, iterating over a collection (such as a hash table) in javascript was something like "for (item in collection) { stuff; }". (I last touched javascript for anything serious ~5 years ago writing a bugtracking system in jscript-based ASP for this startup I was working for at the time, because they Really Need NT *sigh* and were too cheap to buy a real bug tracking system *double sigh*. Yes, totally stupid, but welcome to '99...)
  • by Synn ( 6288 ) on Wednesday July 14, 2004 @12:52AM (#9694056)
    1) They're apathetic about new technology.
    2) If the old language does what they want, why upgrade. It's *Personal* Home Page, after all, not corporate homepage.
    3) Why make things more complex, for very little benifit.


    You forgot:

    4) Because it works.

    I've been the admin for Apache/PHP servers for close to 6 years now and I've not ever had PHP cause a single crash. You can have complete idiots writing PHP scripts and you don't have to worry about them taking down you're entire server with a bad piece of code.

    The truth of the matter is that people like me don't care which side of the OO fence PHP is on, we just want something that works and we don't want to get phone calls on our off hours about something crashing. PHP is a solid solution for that.
  • by Anonymous Coward on Wednesday July 14, 2004 @01:10AM (#9694121)
    Yes, because it's exceedingly difficult to write a general tree or graph algorithm in a language that has arrays of arrays and references.

    I can't believe you got a +4, Informative for a completely inaccurate comment. Congratulations.
  • by wtd ( 791730 ) on Wednesday July 14, 2004 @01:15AM (#9694140)
    The only thing I would add is that Mac OS X users should install Ruby themselvesbefore making any judgements on it. The version shipped with Panther is a bit dated, and if I recall correctly lacks some of the features you get from installing it yourself.
  • by Habbie ( 601521 ) on Wednesday July 14, 2004 @05:10AM (#9694880) Homepage
    $ rpm -qlp roadsend-pcc-prereqs-beta2-1.i386.rpm | grep bigloo
    /usr/bin/bigloo
    /usr/lib/bigloo
    /usr/lib /bigloo/2.6c
    /usr/lib/bigloo/2.6c/bigloo.h
    /usr/ lib/bigloo/2.6c/bigloo.heap
    /usr/lib/bigloo/2.6c/ bigloo_config.h
    <snip>
    /usr/lib/libbigloo_s-2.6c .so
    /usr/lib/libbigloo_u-2.6c.so
    /usr/lib/libbig loofth_s-2.6c.so
    /usr/lib/libbigloofth_u-2.6c.so
    /usr/lib/libbigloogc-2.6c.so
    /usr/lib/libbigloog c_fth-2.6c.so
  • No it wasn't... (Score:3, Informative)

    by Phil John ( 576633 ) <phil.webstarsltd@com> on Wednesday July 14, 2004 @05:28AM (#9694944)
    ...Dmitri who wrote Turck mmcache was offered a job at Zend and, shock horror, took it. However, as mmcache is GPL'd it lives on at sourceforge, with a new cvs commiter appointed (IIRC) and dev work continuing. To be honest though, it's pretty much feature complete so all they need to do is sure up support for PHP5 (still beta at the moment).
  • wrong (Score:5, Informative)

    by solidox ( 650158 ) on Wednesday July 14, 2004 @05:31AM (#9694950) Homepage
    i'm not quite sure where you're getting this from.
    i've been using php5 since the first beta and afaik it has never required overloaded child methods to require the same number of arguments as the parent class.

    <?
    error_reporting(E_ALL|E_STRICT);
    class SomeParent
    {
    function __construct($var1, $var2)
    {
    echo "Parent: $var1, $var2\n";
    }
    }
    class SomeChild extends SomeParent
    {
    function __construct($var1,$var2,$var3)
    {
    echo "Child: $var1, $var2, $var3\n";
    }
    }
    $x = new SomeParent(1,2);
    $y = new SomeChild(3,4,5);
    $z = new SomeParent(6,7,8); /* outputs:
    Parent: 1, 2
    Child: 3, 4, 5
    Parent: 6, 7
    */
    ?>

    as for sqlite as session handler, it is not the default, nor has it ever been the default.
    there was a patch to ALLOW it to be used as a session handler, by setting session.save_handler = sqlite in php.ini
    but if we look at the php.inis in the php5 distribution:
    [solidox@server150 php-5.0.0]$ cat php.ini-*|grep "session.save_handler"
    session.save_handler = files
    session.save_handler = files

    both dist and recommended use flat files as the default session handler.
  • by juhaz ( 110830 ) on Wednesday July 14, 2004 @07:28AM (#9695248) Homepage
    No, perh has not had it, and still does not.

    Those are not compilers, they just bundle the interpreter and needed libraries into package.

Suggest you just sit there and wait till life gets easier.

Working...