Slashdot Mirror


PHP 5 Beta 1

Sterling Hughes writes "The PHP development community is proud to announce the release of PHP 5 Beta 1. Downloads are available in both source and binary form (for Windows users). A full list of changes is available in the ChangeLog. Some of the new features include much improved OO support, completely revamped XML support, and the default inclusion of SQLite."

35 of 398 comments (clear)

  1. Re:mysql? by Triumph+The+Insult+C · · Score: 5, Informative

    --with-mysql=/path/to/mysql

    bundled being the key word

    --
    vodka, straight up, thank you!
  2. Re:They pulled MySQL out! by CausticWindow · · Score: 5, Informative

    Check this thread on Google groups.

    --
    How small a thought it takes to fill a whole life
  3. Re:They pulled MySQL out! by Triumph+The+Insult+C · · Score: 3, Informative

    what's so difficult about using your own mysql installation? this refers to the bundled libraries. aside from changes mysql has made to 4.1, this is a non-issue.

    maybe this will get them to included a bundled version of postgres

    --
    vodka, straight up, thank you!
  4. Re:Problems with newer versions by larry+bagina · · Score: 5, Informative
    I agree. Even though there are huge differences between version 3 and version 4 (and now version 5), there are also lots of differences between minor versions -- stuff like new functions, changes to how functions work (beyond just bug fixes), etc. Nevermind that there are hundreds of optional libraries and setup parameters, making every installation unique.

    If you're doing a non-trivial php site, and trying to make it work with different versions of php (osCommerce, for example), you end up having to rewrite many functions yourself to make sure they work consistently.

    I like PHP, but it suffers from an "incrementalism" design approach. Some stuff really needs to be rethought, and I think PHP 5 is on the right track to doing that.

    --
    Do you even lift?

    These aren't the 'roids you're looking for.

  5. Final version by InsaneCreator · · Score: 2, Informative

    So how long until we get the final version?

    I'm currently developing a PHP project with lots of OO code and it's about as plesant as removing your eyes with a rusty spoon (some control structures implicitly copy objects, they don't know how to return references, you can't write $a->getB()->doSth(); ...).

    Improved OO support in PHP5 would be really nice riht now.

  6. Re:Still re-coding for register_global_variables.. by codegoat · · Score: 1, Informative

    if you have a huge site, doing that is a quite a tedious job. If you want a quick fix. Do the following for all of the variable arrays. -- foreach( $HTTP_GET_VARS as $key => $value ) { $$key = $value; } -- As I said, just do that for POST, COOKIE, SESSION etc. Also, you can change the order so that POST has more weight than get (POST variables overwrite GET variables.) by simply doing the POST after the GET :) Do this in one file and include it in the top of every page. (If you have a config file, do it there, so you don't have to go and include it throughout your entire site) This is an easy fix for doing what you want. -goat

  7. Re:Don't mod me down... by loginx · · Score: 2, Informative

    Not natively (yet) but there are several tools that do this for PHP, such as the Zend Optimizer or the popular PHP Accelerator (PHPA) http://www.php-accelerator.co.uk/

  8. Kinda kludgey by Sanity · · Score: 2, Informative
    There are good reasons that ISPs want to use mod_php - and using your proposed solution these benefits are lost.

    If there was some way that you could allow the user to have multiple PHP versions all being used as Apache modules where the user could select the one they want using their .htaccess file, that would be a possible solution.

    Of course, the real solution is for the PHP development team to take the issue of backward-compatability more seriously then they clearly do at the moment.

  9. Here's the word by john_smith_45678 · · Score: 3, Informative

    On Sat, 28 Jun 2003, Marc Richards wrote:
    > I apologies if this is the wrong place for asking. Is non-experimental
    > Apache2 support planned for PHP 5?

    Nope. Until someone sits down and goes through every 3rd-party library that can be linked into PHP on every platform and identifies whether or not they are threadsafe and under which conditions they remain threadsafe, using PHP in a threaded web server on UNIX is going to remain experimental.

    You can of course stick with non-threaded prefork mode, in which case you basically have Apache-1.3.x. Nobody so far have been motivated to test Apache2-prefork+PHP extensively, so even that combination is going to remain experimental.

    The basic problem here is that the average UNIX library has not been written with thread safety in mind. You can write very good specific threaded programs on UNIX, but it is extremely difficult to write something which can potentially link in hundreds of random libraries and expect them to all be threadsafe.

    -Rasmus

    http://news.php.net/article.php?group=php.internal s&article=%3CPine.LNX.4.56.0306272256280.6461%40th inkpad.lerdorf.com%3E

  10. Re:Yeah Yeah... by Anonymous Coward · · Score: 1, Informative

    I don't mind so much the fact that you can't have servlet-like objects which handle entire sections of your URLspace (as opposed to one URL -- how very un-spider-friendly.

    Nah, it's easy http://www.sitepoint.com/article/485 -- no question marks needed!

  11. Re:Still re-coding for register_global_variables.. by FryGuy1013 · · Score: 5, Informative

    um..

    extract($_POST);
    extract($_GET);
    extract($_COO KIE);

    ?

    --
    bananas like monkeys.
  12. Advice & Observation by calebb · · Score: 2, Informative

    Advice:
    The default method of configuring PHP is with the CGI SAPI module (i.e., php.exe); A much better choice (imo) is to configure the CLI SAPI module - all you have to do is build the CLI SAPI .dll (Depending on which webserver you're using - php4apache.dll for Apache, php4isapi.dll for IIS)

    (Also, many websites refer to the two config methods as CGI and SAPI; This is not really correct since CGI *is* a server API. What they really mean is CGI SAPI & CLI SAPI)

    So, why go through the trouble to compile .dll's to run PHP as an integrated CLI SAPI? Performance! This method was officially documented as a stable feature in the December 2002 build of PHP.

    Ok, so you're still asking WHO CARES??? Here's why you care: When you use the '.dll' method (CLI SAPI), much more of the processing work is passed onto the kernel resulting in fewer system calls. A LOT of people complain that PHP is slow & inefficient compared to other webservers, but oftentimes, these people haven't tried the CLI SAPI of PHP! Their point of reference is an ISAPI webserver (IIS) & they are comparing apples to oranges.

    To find out what SAPI you're using, just execute php -v

    Observation:
    PHP adds new functions & deprecates other functions waaaay too often; No wonder people are leery of upgrading!

    1. Re:Advice & Observation by aint · · Score: 2, Informative

      This post has some problems as there is no such thing as a CLI dll... In Windows you have two php.exe binaries, the cli in the cli/ folder, and the cgi in the root php source folder. The CLI WILL NOT work with the web server, it's a Command Line Interface.

      Regarding the DLL, you are referring to SAPI modules, not CLI. And yes, using them is preferred (although depends on who you ask :) but this topic is not related to this thread on the PHP 5 Beta.

  13. Re:XML transformation pipeline by jojo80 · · Score: 3, Informative

    Something like that already exists...it's called popoon and part of the bitflux cms project.

  14. Re:Kiss and say goodbye to Java language!! by HeadDown · · Score: 3, Informative

    > No Java, no JSP man. Simply use PHP for web development.
    > Forget Java man and go to PHP!
    >
    > PHP is 4 times faster than Java technology 'JSP' (Java server
    > pages).

    Substantiate that statement. What benchmark, what workload, etc.

    > This tallies because compiled "C" program is 4 times faster than
    > Java.

    PHP scripts are re-interpreted, at runtime, *for every page hit*.
    They're not C.

    > Moreover, PHP is getting the object oriented features of Java
    > language.

    Yeah, *finally*. Partially. This is the 1st go. Java was designed from
    the start to be OO, it isn't hobbled on like with PHP.

    > The real usefulness of Java is 'Java applets' which run on
    > client browsers but on the server side you simply use PHP.

    Substantiate.

    > PHP is a very lightening fast object oriented scripting
    > language. PHP is 100% written in "C" and there is no virtual
    > machine as in Java. Nothing can beat "C" language ("C" is a
    > language which never dies!!)

    Jeez, moron. What do you think the JVM is written in?

    > (Java is just another language. The PHP project needs millions
    > of Java programmers who can add the Java's language features
    > like inner classes, static, private, protected and others to
    > PHP. PHP already has some of java' features).
    > Java programmers will really "LOVE" PHP as PHP class is
    > identical to Java's class keyword.

    I use Java and PHP, and I *loathe* PHP. It's single redeeming feature
    is that it's everywhere. For the rest, it's a language with crappy
    library support, that actively emcourages mixing the presentation and
    business layer.

    > Read the benchmars of Java JSP and PHP. PHP tops in the speed!!

    Substantiate.

  15. Re:Kiss and say goodbye to Java language!! by crunchywelch · · Score: 4, Informative

    Uh, none of those links work, however here is a *recent* comparison of JSP and PHP using several different containers for JSP and PHP. It seems that the server setup has a great deal to do with the speed of the application (duh).

    It's interesting that people like to make comparisons to JSP and ASP all the time but don't remark on what platform they run on. Obviously JSP running on tomcat/apache through with mod_jk will be slower than with just plain Resin.

    And open should note that a statement like ' Kiss and say goodbye to Java language!!' almost sounds like a troll, when you consider Java is used for a great deal more than web applications, indeed the servlet functionality that JSP relies on is a *very* small portion of the overall tools that Java supplies to developers.

    But whatever, use the right tool for the job and try to remember it's technology, not religion. The more options the better IMO.....

    --
    1400x1250 in a 640x480 world...
  16. Re:XML transformation pipeline by Dalroth · · Score: 2, Informative

    http://www.interakt.ro/products/Krysalis/

    You can also use PHP as a generator in Cocon.

  17. FREE!! -- PHP Encoder and Cacheing -- FREE!!! by Anonymous Coward · · Score: 5, Informative

    Yes yes.. To sooth all the scalp scratching surrounding PHP and FREE (quality) cacheing and encoding look no futher than

    MMcache - http://www.turcksoft.com/en/e_mmc.htm

    It's only a split second .001 slower than zend (faster than PHP Accelerator) and it FREE! Did I mention it works with Zend Optimizer , Zend Encoder and it can also Encode (protect) PHP files?

    I'm too damn good to you people! ; )


    PS: PHP makes programming fun again. Thats why people like to use it. Simple really.

  18. Re:Problems with newer versions by Billly+Gates · · Score: 2, Informative
    One of the reasons to use PHP or ASP over CGI is speed.

    Both PHP and ASP are compiled and linked directly to the webserver daemon. CGI uses an interface and the engine is not loaded directly with the web server. This makes it alot slower and you lose all the benefits of what php has to offer.

  19. Re:Yeah Yeah... by eadz · · Score: 3, Informative

    I don't mind so much the fact that you can't have servlet-like objects which handle entire sections of your URLspace
    You can! Use a PHP file instead of a directory for your DocumentRoot in apache.
    I.e DocumentRoot /var/www/servlet.php
    Now all requests are handled by servlet.php.

  20. Re:Yeah Yeah... by eadz · · Score: 2, Informative
    Yep. It has one drawback though, and that is all requests are handled by servlet.php. If you have an images/ directory, you'll have to put code in your servelet.php to include those files!
    A more flexable approach I use for the same effect is a .htaccess :

    RewriteEngine on
    # if requested resource doesn't exist
    RewriteCond /%{REQUEST_FILENAME} !-f
    # redirect to default request handler
    RewriteRule ^(.+) /logic.php

    This means if you request /page.html and page.html exists it serves it. If it doesn't exist the request is handled by /logic.php. You can then either serve up some content based on the url or return a 404 header.
  21. Re:What about apache2? by Billly+Gates · · Score: 2, Informative
    Well I tried out FoxServ on my Windows2k box because I am lazy and did not want to configure php and apache2 myself.

    You can find it on sourceforge.

    Its basically apache2, perl 5.6, tlc/tk, python 2.2, mysql, and php 4.2 installed as one package. I think their is a Unix version as well but I do not use it.

  22. PHP 5 Documentation update by aint · · Score: 4, Informative

    PHP 5 isn't really documented in the PHP 5 manual yet as there are still a few features on the move, and new features to come, but here's a list of PHP 5 related articles and presentations:

    Faq: Where can I get more information about PHP5?

    Enjoy!

  23. Re:Yeah Yeah... by Second_Derivative · · Score: 4, Informative

    Nah, I reckon one could handle it like this...

    <VirtualHost *>
    ServerName www.myhost.com
    DocumentRoot /home/myhost/engine.php
    Alias /res /home/myhost/resources
    </VirtualHost> ... or something. I tried it on my server and it seems to work a treat. Once again cheers for the tip

  24. Re:They pulled MySQL out! by Matty_ · · Score: 2, Informative

    I am pretty sure that PHP 4 comes with a MySQL client library, and it is enabled by default during 'configure'.

    In FreeBSD Ports, it compiled the MySQL client package and uses it instead.

  25. Re:Requires Microsoft Visual C++ by Anonymous Coward · · Score: 1, Informative

    Some people are bound to bring up the $109 Microsoft Visual C++ Learning Edition,

    Actually, you can download the non-optimizing compiler for free from their web site. Seriously though, who wants a compiler with no optimization?

  26. Re:Windows Users by pompousjerk · · Score: 2, Informative

    Yeah, and I got PHP5b1 up and running in about 10 minutes. No time spent compiling. ;)

    Nothing works! At least, nothing using PHP4's OO features. And I used a lot of PHP4's OO features!

    I'm going to spend the rest of the day tearing out my hair. Especially because I'll have to rewrite 1000+ lines of PHP code....

  27. Both by Delirium+Tremens · · Score: 2, Informative

    Both will win.
    The latest news from Sun is that J2EE 1.5 will support scripting languages. And the reference implementation will be done in PHP.
    If you don't believe, check some of the news site reporting on JavaOne 2003.

  28. Re:Requires Microsoft Visual C++ by Anonymous Coward · · Score: 3, Informative

    MySQL isn't bundled with it, but you can easily add it yourself when compiling.

    Compiling?

    Compiling PHP for Windows requires the Microsoft Visual C++ compiler version 6.0 or later.


    Exactly version 6.0, not "later" (because you can't compile/link with GPL stuff with the 7.0/.NET compiler due to licensing restrictions).

  29. Re:Still re-coding for register_global_variables.. by amanpatelhotmail.com · · Score: 2, Informative

    even better: (add to .htaccess file to your codebase directory) php_flag register_globals On

  30. Re:PHP fragmentation, lack of cohesion by OzRoy · · Score: 2, Informative

    Actually if you go read that OOP page properly you will see that they added a lot of features needed to be a proper OO language. In every case they said "If you don't use this feature, the old method will be used". As far as I can tell this keeps compatability.

    As for the new arrays that appeared in newer versions of PHP that broke everyone's scripts. It's a simple configuration change that will revert PHP back to the old methods while you change your scripts to get them working again.

    Those new arrays ARE necessary. The old method of getting your form data is badly insecure. They explained all this, and gave example code as to why the old ways were bad. I believe it went something like this:

    if (isAuthenticated()) {
    $authenticated = true;
    }

    In that example $authenticated would Never be set using a form. But, if register_globals is set to on, all a person would have to do is pass a 'authenticated' parrameter to the script and they have instant access. Yes it's a pretty stupid thing for a programmer to do, but these things do happen. I think everyone should be FORCED to upgrade to the new version.

    PHP is Still simple. You can still write the basic code you want to write, but it now gives us the functionality we want to make really powerful scripts. At least I know I want them. I will use 90% of those new features as well. As far as I'm concerned these changes are LONG overdue and it's about time PHP caught up with the real world.

  31. More info on MySQL/PHP5 by mtabini · · Score: 2, Informative

    In case anyone is interested, I've followed the PHP5/MySQL on my blog. (it also contains instructions for getting MySQL back into PHP)

  32. Re:No Function overloading? by Malcontent · · Score: 2, Informative

    It's not bad. In the case of PHP it's not needed. PHP is not a storngly typed language so you can write a getBalance() function which can take any damned thing you can pass in.

    Once inside the function you can test the passed in variable and take appropriate action.

    You can also do other crazy things like declare functions without parameters and pass parameters into them.
    You can declare methods that act as "default" method handlers.
    You can add methods to objects at runtime!.
    Hell you can even define classes at runtime.

    It's highly dynamic.

    If

    --

    War is necrophilia.

  33. Re: Just use PEAR/DB by PizzaFace · · Score: 4, Informative

    Instead of ODBC, you'd be better off using the pear/db module as middleware. It supports more databases (mysql, odbc, sqlite, pgsql, etc.) and if it isn't the future standard for database access in PHP, something like it will be.

    I've been using PHP's built-in (until now) MySQL functions, because they're faster than pear/db, but this licensing dust-up has convinced me that portability among database vendors is worth a performance hit. And the pear/db module is getting increasing attention and is likely to get faster.

  34. Re:Yeah Yeah... by pacman+on+prozac · · Score: 4, Informative

    My biggest complaint about PHP is the joke that they pass as "error handling". Yeah great, thanks for exposing all my path names to the outside world if something goes wrong.

    Psychic abilities will be added to PHP as of version 6.6.6. From here on you will be able to simply think of the configuration you want and it will be set in php.ini. No longer will you have to read the extremely comprehensive online docs including the manual and especially not the ENTIRE SECTION dedicated to error reporting and logging that tells you extremely clearly how to do what you have just complained is impossible. You would not need to read that page and find the two links within the 1st side that show very clearly information on the display errors, error_log for custom logs and of course log errors to put the errors in the apache logfile.

    Your biggest complaint is that you are too lazy to read the manual and you expect everything to be done for you. No programming language can help you with this.