SitePoint Sponsor

User Tag List

View Poll Results: PHP 4 or 5?

Voters
271. You may not vote on this poll
  • PHP 4

    61 22.51%
  • PHP 5

    210 77.49%
Page 3 of 5 FirstFirst 12345 LastLast
Results 51 to 75 of 102

Thread: PHP 4 or 5?

  1. #51
    SitePoint Member
    Join Date
    Oct 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question PHP configuring with MySQL

    Hi,

    I am new to PHP. I have one problem while configuring PHP. I have installed MySQL in one box and apache web server in another. How can i confgure so that it support MySQL.
    It may b silly question... please hlep.

    Thanks in advance

    Regards,
    Santhosh

  2. #52
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your new, install XAMPP for windows or MAMP for mac OS/X.

    In short you stated that you installed MySQL and Apache in different "boxes", meaning different computers. Apache & MySQL should be set up to run on one system, I'm assuming that you are trying to do the install so that you have Apache, MySQL and PHP set up so you can start coding in PHP .... if I'm correct, see line 1, above.
    intragenesis, llc professional web & graphic design

  3. #53
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    436
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That's nothing to do with this discussion.

    Quote Originally Posted by santhoshk
    Hi,

    I am new to PHP. I have one problem while configuring PHP. I have installed MySQL in one box and apache web server in another. How can i confgure so that it support MySQL.
    It may b silly question... please hlep.

    Thanks in advance

    Regards,
    Santhosh

  4. #54
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    436
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    For me it's a case of if it isn't broken, don't fix it. PHP4 does everything I need, I can't miss features I've never used before. Furthermore, I've yet to work with a hoster that has supported version 5 by default so PHP 5 is not an option.

    Are version 4 scripts fully compatible with version 5?

  5. #55
    SitePoint Enthusiast Saidin's Avatar
    Join Date
    May 2005
    Location
    Netherlands
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DrQuincy
    Are version 4 scripts fully compatible with version 5?
    Well, mostly, but php 4 passed objects by value unless you explicitly declare passing by reference. php 5 passes objects by reference. There may be some differences with default security settings, but these could be changed manually.

  6. #56
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DrQuincy
    That's nothing to do with this discussion.

    It has everything to do with the question that was asked, thus, this discussion. They guy wants to get Apache, PHP and MySql running... what better way than to download XAMPP or MAMP, double click on the install, and everything runs fine. If that wasn't the case, then he would have posted in the configure your server forum.

    In any case, most web hosting providers have PHP4 and PHP5 installed already. Installation of PHP5 was a slow move, however, most everyone has installed it on their servers by at least the first quarter of this year.

    --->
    Btw, checked your web site, from your sig, the gray is hard on the eyes.<----
    intragenesis, llc professional web & graphic design

  7. #57
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the real reason why people won't move from PHP 4 to PHP 5?

    hosting restrictions aside - if you ask me its due to the skill level of the developer. Those using PHP 4 still through choice are either not technically good enough to code in PHP 5/Object Oriented (and the most likely in this case), only use it casually (procedurally) and so feel there's no great benefit, or have a 'fear of the unknown' kind of attitude.

    either way, those still using PHP 4 - more fool you i say. if you want to continue developing low end apps with a low end language version, then you carry on and do that

    obviously for some the learning curve is either too steep or they can't be bothered to learn; in which case, they might want to think about the industry they work in! you cannot afford to stand still and get stuck in the old times in the web development world.

    PHP has always been known as a low entry level language, and it shows with thsi scenario. two opposing forces, the low entry coders who simply cannot do real programming, and the more experienced/skilful programmers leaning towards a more enterprise language (Java like), going in opposite directions. the low entry coders want to keep it all simple, and the others want it more advanced.

    at the moment, unfortunately , it seems the low entry coders are winning the 'battle' though of course as time goes by their grip loosens and eventually will diminish. Hopefully, PHP 6 may prove to be the straw that strikes the camels' back, but we shall see ...

  8. #58
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by smithie
    the real Those using PHP 4 still through choice are either not technically good enough to code in PHP 5/Object Oriented

    I agree, however, code some pure Java, which is completely OOP oriented, and you'll be easily ready for PHP 6, 7, 8, 9 ...
    intragenesis, llc professional web & graphic design

  9. #59
    SitePoint Evangelist
    Join Date
    May 2006
    Posts
    436
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Saidin
    Well, mostly, but php 4 passed objects by value unless you explicitly declare passing by reference. php 5 passes objects by reference. There may be some differences with default security settings, but these could be changed manually.
    What do you mean exactly? Are they like pointers in C? Is there an example anywhere that compares PHP4 to 5?

    I must admit I assumed PHP 5 was just a tweaked version of 4 and didn't realise the change was so substantial.

    And smithie don't say some of us PHP4 users are not technical enough to program in PHP 5, I've been developing apps in Java and C++ since 2001 - PHP is a walk in the park for me. There are other factors besides techical ability that determine what people use.

  10. #60
    SitePoint Wizard holmescreek's Avatar
    Join Date
    Mar 2001
    Location
    Northwest Florida
    Posts
    1,707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DrQuincy
    What do you mean exactly? Are they like pointers in C?
    Yes, but php being a scripting language, you don't "really" have to deallocate references -- the script runs, terminates, and that is that, unlike a desktop C/C++ app where the stack & heap are constantly being used.

    Quote Originally Posted by DrQuincy
    Is there an example anywhere that compares PHP4 to 5?
    What's new in PHP 5 & 6, with comparisons against PHP 4.

    http://www.phpbuilder.com/columns/ia...n20051206.php3
    intragenesis, llc professional web & graphic design

  11. #61
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DrQuincy
    What do you mean exactly? Are they like pointers in C? Is there an example anywhere that compares PHP4 to 5?
    I must admit I assumed PHP 5 was just a tweaked version of 4 and didn't realise the change was so substantial.
    PHP4 has a very odd object model. Unlike almost every other OO language, objects are implicitly cloned in PHP4, when passing them as parameters or returning them from functions. The only way to circumvent this behaviour is by using references. References are almost the same as a pointer in C, but not really. A pointer is a variable that points to data. A reference is a variable that points to another variable. There's some further explanation of them in the php manual.
    In PHP5, objects are not cloned implicitly, so the hack isn't needed.
    They changed the way references work in v. 4.4, so if your code didn't break on this upgrade, it most likely won't break on PHP5 either. Basically, if you don't know what I'm talking about, you probably won't be affected.

    I upgraded a fairly large application with about 10 slightly different installations in the beginning of this year. It took me about a days work. In my experience, the switch was quite smooth.
    Paradoxically, the thing that pushed me to finally upgrade was that 4.4 broke BC, and since I would have to patch my code anyway, I could aswell go for PHP5.
    The thing that took me the most time, was exactly to go through my code and change all thoose ampersands which were needed in PHP4.

  12. #62
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by DrQuincy
    And smithie don't say some of us PHP4 users are not technical enough to program in PHP 5, I've been developing apps in Java and C++ since 2001 - PHP is a walk in the park for me. There are other factors besides techical ability that determine what people use.

    yes - and if you read my post correctly, you'd see that i covered that:

    Quote Originally Posted by smithie
    hosting restrictions aside - if you ask me its due to the skill level of the developer. Those using PHP 4 still through choice are either not technically good enough to code in PHP 5/Object Oriented (and the most likely in this case), only use it casually (procedurally) and so feel there's no great benefit, or have a 'fear of the unknown' kind of attitude.
    highighted and underlined for your convenience, are three other 'factors' for using PHP 4. sorry if i've missed one, but those three should pretty much cover these 'factors' you speak of, unless you have any others you want to add?

    for what reason do you use it?

  13. #63
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I personally don't think OO is essential for web applications. HTTP is rather simple and linear too, and so if procedural code works, why not use it?
    "Never imagine yourself not to be otherwise than what
    it might appear to others that what you were or might
    have been was not otherwise than what you had been
    would have appeared to them to be otherwise."

  14. #64
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Lithuania, Europe
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by eldacar
    I personally don't think OO is essential for web applications.
    OOP works great in all types of apps (well, maybe except low level programming and all those cases where every microsecond matters), web being no exception. The greater the complexity, the more valuable it becomes.

  15. #65
    SitePoint Addict
    Join Date
    Dec 2005
    Posts
    276
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My point was that the web doesn't always need to be complex
    And speed often does matter, if you have a lot of users. It's better to optimise your code than buy additional server rack space.
    "Never imagine yourself not to be otherwise than what
    it might appear to others that what you were or might
    have been was not otherwise than what you had been
    would have appeared to them to be otherwise."

  16. #66
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP 5 has more ability, compiles faster, and supports scalable/portable code (oop) ... clear choice.

  17. #67
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Compiles faster? You mean is interpreted faster, right?

  18. #68
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Lithuania, Europe
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by eldacar
    My point was that the web doesn't always need to be complex
    I'm not sure why you think web apps are different. The same point applies to any type of software, web or not.
    Quote Originally Posted by eldacar
    And speed often does matter, if you have a lot of users.
    Speed does matter, but this is not a valid argument against OOP for web since the decrease in performance is minimal and well worth the benefits OOP brings to the table.
    Quote Originally Posted by eldacar
    It's better to optimise your code than buy additional server rack space.
    It is not uncommon for companies to just by additional hardware power instead of having programmers optimize every loop in the app. Hardware is cheap, good developers are not.

  19. #69
    SitePoint Addict Iceman90's Avatar
    Join Date
    Mar 2006
    Location
    Calgary, Alberta, Canada
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know some hosts that allow both versions of PHP. To make a PHP4 document, one would name the document with a .php extension. To make a PHP5 document, one would name the file with a .php5 extension.

    This seems to be a good solution at this point.

  20. #70
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ugh, I don't think so Iceman90.

    Not to sound immature or anything, but that's so .php3

  21. #71
    Web developer Carl's Avatar
    Join Date
    Sep 2003
    Location
    sweden
    Posts
    320
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why PHP5? Because PHP4 cannot last forever.

  22. #72
    SitePoint Member mgraphic's Avatar
    Join Date
    Oct 2006
    Location
    West Hartford, CT
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have not yet figured out as to why hosting companies using v4 outweigh those who offer v5. I'm in the process of developing system for my church, and when it comes to the point of making it live, I will require PHP > 5.1 for the functions I am using.


  23. #73
    SitePoint Member mgraphic's Avatar
    Join Date
    Oct 2006
    Location
    West Hartford, CT
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by holmescreek
    If your new, install XAMPP for windows or MAMP for mac OS/X.

    In short you stated that you installed MySQL and Apache in different "boxes", meaning different computers. Apache & MySQL should be set up to run on one system, I'm assuming that you are trying to do the install so that you have Apache, MySQL and PHP set up so you can start coding in PHP .... if I'm correct, see line 1, above.
    That is not necessarly correct because you can connect over another server such as http://www.website.com:3306 (3306 is the default mysql port) as long as mysql is setup for it and there is no blocks on the hosting server.

  24. #74
    SitePoint Addict
    Join Date
    Nov 2005
    Location
    Moss, Norway.
    Posts
    283
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. You use the tool that is good enough to solve your problem.
    2. If the only tool you have is a hammer, everything begins to look like a nail.
    3. If I should write a complex API (classes), I would most probably prefer PHP 5 because of the better OOP functionality.

  25. #75
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My blog entry on this

    php4/5

    (I prefer to use hostgator for most if not all sites, and they're just really hsistant to go up to php5. )


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
  •