SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 69

Thread: PHP4 or PHP5

  1. #26
    Web developer chrisranjana's Avatar
    Join Date
    Jan 2001
    Location
    chennai , tamil nadu , India
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes basically It is the shortage of php5 webhosts that makes us cling to php4 for dear life
    Chris, Programmer/Developer,
    Laravel Php Developers, Ruby on Rails programmers,
    Moodle, Opencart, Magento, Geodesic Classifieds/Auctions,
    www.chrisranjana.com

  2. #27
    Awesome Addict
    Join Date
    Mar 2004
    Location
    Toronto, Canada
    Posts
    326
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by centrilo
    From what I hear, exceptions in php5 are a joke, catching an exception does not stop the php error handler from giving out an error.
    Huh? Can you provide an example?

  3. #28
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Malaysia
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gregor002
    Huh? Can you provide an example?
    Let's say you're trying to connect to a MySQL server that doesn't exists and you want to throw an exception if connection is not established (just for the sake of testing).

    However, if you do not suppress any error notices (look at codes below), it will still generate error notices before an exception is thrown.

    PHP Code:
            // part of more codes...

            
    $this->link_id mysql_connect('invalid.host'$db_username$db_password); // this line will generate errors.

            // the following line will fix the problem above
            //$this->link_id = @mysql_connect('invalid.host', $db_username, $db_password);

            
    if (!$this->link_id)
            {
                throw new 
    Exception('Unable to connect to MySQL server.');
            }

    // part of more codes... 
    To use it properly simply set error_reporting(0) during production state or use @ to suppress any errors that the function might cause. Don't seem to be any problem for me.

    I'm using PHP5 at the moment for my new project and I'm in love with the built-in Exception support.

  4. #29
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Auckland, New Zealand
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Translating PHP5 classes back to PHP4 - the losses

    I recently made two versions of a set of PHP HTML tabular reporting classes (http://www.phpclasses.org/browse/package/2467.html) - the PHP5 versions, which is what I originally developed them in, and the PHP4 versions. The latter were made grudgingly because most web hosting still uses PHP4.

    The things I missed most in the step back to PHP4 were __autoload (saves a lot of time and code maintenance), and the way PHP5 passes objects by reference as default (which feels intuitive to me).

    I also disliked having to make all properties and methods effectively public which compromises encapsulation.

    On other projects PHP5's static methods have proved to be a useful way of organising code and there are numerous other nice touches.

    My experience is that once you make the shift, you don't want to go back!

  5. #30
    Awesome Addict
    Join Date
    Mar 2004
    Location
    Toronto, Canada
    Posts
    326
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Snecx
    I'm using PHP5 at the moment for my new project and I'm in love with the built-in Exception support.
    ... I'm in love with try/catch, myself.

  6. #31
    SitePoint Zealot asmictech's Avatar
    Join Date
    Oct 2004
    Location
    nigeria
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can anyone recommend a good book or web site that gives an in-depth tutorial on migrating (as a programmer) from PHP4 to PHP5? I'd like to know what's new and how it works. The PHP.net site isn't really great with documentation for general features and explaining how something would best be accomplished.
    similar question:- now i have php anthology by harry fuecks though he has it on cover page php 5 ready, i want an information on this if the book is based on php 5 or not. if not which book will help?
    Success is achieved and maintained by those who keep trying.

    www.ngportal.net

  7. #32
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Malaysia
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can find quite a lot of information on the internet alone. I migrated to PHP5 just by researching online.

    http://www.zend.com/php5/migration.php is the best place for me at the moment.

  8. #33
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can code in PHP5 using the standard PHP4 functionality, without going in the OOP side.

  9. #34
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Malaysia
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It doesn't make much sense to switch to PHP5 if you just plan to use the standard PHP4 stuff since very little hosting companies support PHP5. The only reason for me to switch is the great OOP support in PHP5.

    And of course you can still code some simple stuff and it will work in both PHP4 and 5.

  10. #35
    Level 8 Chinese guy Archbob's Avatar
    Join Date
    Sep 2001
    Location
    Somewhere in this vast universe
    Posts
    3,741
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think OO is overated in PHP applications unless your trying to port a desktop app to PHP. For programming forums and CMS system, I still feel non OO using function is just as good or even better than OO systems. The only exception may be the templating system.

  11. #36
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still feel non OO using function is just as good or even better than OO systems.
    Huh?

    The only exception may be the templating system.
    Huh? WTF? Just what is the difference from a templating methodology, as from the rest of the application that has to implement it? If the templating engine is primary object oriented, then using object oriented programming for the application it's self as well will just increase the benifits from the start.

    If you actually believe that procedural programming offers greater benifits to you, over object oriented programming, then either you have not yet developed a sizable application with object oriented methods, not once, or your just speaking a load of horse manure, basically?

    And that is me being polite okay... Never heard as much -BEEP- in my life, really.

  12. #37
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No OOP, no good coding style

  13. #38
    Non-Member Musicbox's Avatar
    Join Date
    Nov 2004
    Location
    india
    Posts
    1,331
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the moment 80% of php programmers are expert in php 4 but not in php 5 it will take some time globally to expertise in php 5.

  14. #39
    SitePoint Zealot
    Join Date
    May 2004
    Location
    Malaysia
    Posts
    181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I still feel non OO using function is just as good or even better than OO systems.
    Impossible.

  15. #40
    SitePoint Member
    Join Date
    Jul 2005
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm a huge fan of PHP5, however ISP's are a definite consideration. I'm currently switching back and forth on my development machine, largely for testing and designing more PHP5-oriented applications (backward-compatible it may be, but private objects are SOOO cool!).

    My top pick to spell the differences between PHP4 and PHP5? O'Reilly's 'Upgrading to PHP5', found at http://www.oreilly.com/catalog/upgradephp5/inx.html

  16. #41
    SitePoint Member sadegh's Avatar
    Join Date
    Jul 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php5 support OOP completely and it has a good error handling , a good classes for using XML and other benefits.
    I am sure that php5 is better than php4 but there is a question(?)!.
    Why are hosting companies support php5 very little ?

  17. #42
    SitePoint Zealot MystaMax's Avatar
    Join Date
    Apr 2003
    Location
    Atlanta
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Seeing how he said its for a business and I'll go out on a limb and assume that these servers will be hosted inhouse. Why hosting companies are using PHP 4 over PHP5 is irrelevant.

  18. #43
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php4 has been proven, well tested, and works.

    There is crap software that doesn't run on php5, such as oscommerce (well, it -runs- but you need to edit a couple files)

    I think it's the fear of breaking things... I used to admin a good amount of oscommerce installs, and it became a pain in the butt to fix the files...

    phpbb didn't work properly in php5 until recently...

    let's all just pray for php5.1 getting accepted.... cPanel already supports php5, plesk doesn't play nice with php5 atm... so all in due time
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  19. #44
    SitePoint Addict jough's Avatar
    Join Date
    Sep 2001
    Location
    You have moved into a dark place. It is pitch blac
    Posts
    248
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know how many of you were coding in PHP when PHP4 came out, but there was just as much (if not more) caution and a slowness to upgrade when people started to move from PHP3 to PHP4 too.

    PHP5 is more backward compatible and already a very mature product (the first version of PHP4 was lacking in a number of ways) so it makes sense that it'll be adopted a bit faster.

    PHP4's been around for what, six years? And it made PHP popular as THE scripting language for dynamic web sites. It'll take some time before PHP5 reaches that level of ubiquity, but it'll happen, especially since most hosts seem to think that the release of PHP5.1 is the "signal" to finally upgrade to it. I know I'm waiting for all of the early adopters to work out the kinks first.
    My Dynamic Site in Action:
    Poetry X Poetry Archive

  20. #45
    SitePoint Addict
    Join Date
    May 2005
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by dreaz
    What about migrating from PHP4 to PHP5? I really want to do it, but I can't all at once.
    Is there a safe, stable way of running both PHP4 and PHP5 on the same server (apache, on a freeBSD)?

    Also, are you guys still using MySQL with PHP5? What about SQLite? It seem like a pretty good database engine to me. Do you think it would be better for small databases (like 300-600k entries)?
    I'm about 99% sure that you don't use anything in PHP4 that wll not work in PHP5. Just upgrade, and both will work.

  21. #46
    SitePoint Addict
    Join Date
    May 2005
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by centrilo
    There is a shortage of quality PHP5 hosts, most web hosts are still on php4.
    Dreamhost, Nexcess, and dozens of others support it. This is completely false.

    From what I hear, exceptions in php5 are a joke, catching an exception does not stop the php error handler from giving out an error.
    You can only catch user-defined exceptions at present (overriding PHP's built in stuff to throw exceptions instead of displaying errors is planned for 5.2, I believe). If you're throwing an error and throwing an exception, you need to learn how to program using exception handling in the first place.

    Want to learn PHP5? Get a decent book on Java or C++ -- especially Java. You'll find more similiarities than you can shake a pure virtual class at.

    It doesn't make much sense to switch to PHP5 if you just plan to use the standard PHP4 stuff since very little hosting companies support PHP5.
    Really? Try this:

    http://www.sebastian-bergmann.de/blo...rformance.html

    Not to mention functions like:

    file_put_contents
    mysqli (procedural)
    simpleXML
    etc.

    You don't have to be an OO programmer to find things that are better in PHP5. More importantly, if you're not an OO programmer, there's nothing that breaks at all, so you have nothing to lose.

    I think OO is overated in PHP applications unless your trying to port a desktop app to PHP. For programming forums and CMS system, I still feel non OO using function is just as good or even better than OO systems. The only exception may be the templating system.
    I develop Content Management Systems for web sites that serve millions of pages per day, and the product I'm doing in PHP5 is infinitely easier to upgrade, maintain, and extend than the PHP4 version. Not only that, it makes handing modules off to different developers a cinch, provides easy API development, etc. Have you actually tried it (the right way?)

    At the moment 80% of php programmers are expert in php 4 but not in php 5 it will take some time globally to expertise in php 5.
    At the moment about 5% of php programmers are "expert". These are the people who already have and/or could pass the Zend Certification test (roughtly 600 people in the whole world have passed. Some of us haven't taken it yet due to time constraints and the like).

    You guys keep using the argument for hosts, and then mentioning things like cPanel, Plesk, etc. Guess what? Those things aren't a concern for companies that run their own servers, have their own system administrators, and are doing the development work in-house.

    I'd venture to say that every web hosting company worth their salt that hasn't already upgraded to PHP5 will do so in the very near future. The only people who don't are the technophobes out there who refuse to actually test anything for themselves, and probably still insist that they can't upgrade to Apache 2 (which has been out for 5 years) until it's "stable".

  22. #47
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the moment, PHP5 hosting is not a problem, God I have my site hosted for PHP5 and it's 99.9% object oriented, so no problems, and my class hierarchies are pretty complex.

    Dump your PHP4.x scripts now. Just do it, don't think about it for one moment to run your PHP4.x scripts under PHP5 as your just looking for trouble in my view. Get yourself ready, and script with PHP5.x from a clean slate.

    I dumped all my scripts, and started again and I saved myself time, effort and a lot of stress. I didn't lose nothing in doing so, either. If your boss makes an arguement, look for another job, as your boss is just being a complete prat.

    There is no reason from the business sense, not to develop with PHP5.x, from my experience.

    Another point I'll add is that if you develop PHP4.x with procedural programming methodologies, and you want to move on up to PHP5.x? Don't bother, as you'll not get much benifit unless you're going to develop object oriented programming.

    Only then will you see any benifits

  23. #48
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    God I have my site hosted for PHP5. Only then will you see any benifits
    Further development in PHP4 will surely bring troubles if not right away, then with the next PHP6 release. The compatability would be harder to maintain, and some features will be dropped

    Also, take in consideration, that PHP5 has everything an average developer (99% of all PHP developers, excluding Dr Livingston ) would ever need.

  24. #49
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    excluding Dr Livingston
    Funny...??

  25. #50
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    php5 have everything? Not exactly....

    As for php5 argument Dr Livingstone, some control panels, aka PLESK don't have support for php5 yet (well, it's coming this week or next, hopefull)

    I run php5 on my in house servers, but the main production server is php4 still...
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •