Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 12 of 12

This is a discussion on Should I learn PHP 4 or 5? in the Open Discussion & Chit-chat forum
So far, all my web sites have been built using html and perl. I've been led to believe that learning PHP should be a fairly ...

  1. #1
    Loyal Client
    Join Date
    Jun 2004
    Posts
    101

    Should I learn PHP 4 or 5?

    So far, all my web sites have been built using html and perl. I've been led to believe that learning PHP should be a fairly easy transition. However, I'm not sure whether I should learn PHP 4 or 5. I've read many posts on this forum regarding PHP and changes that are underway, but I'm not clear where I should start.

    I am running an Apache server on my local windows machine for development and would like to download and learn whichever PHP version makes the most sense. Any recommendations?

    Thanks,
    Mike

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    The biggest difference between PHP4 and PHP5 is that the latter adds improved object handling. In PHP5, for example, objects are passed by reference by default (as is the case with most OO languages) instead of by value as they are in PHP4. PHP5 also gives the programmer the option of using an OO interface to do certain opperations, such as connecting to databases, where PHP4 only supports using a set of functions taht pass around a reference variable. Finally, PHP5 has a few new features like better XML parsing that are built in.

    As far as the core language, other than what I've stated above, it really hasn't changed. The basics--like declaring variables, function handling, order of opperations, and the like hasn't changed. Some of the libraries that are standard in PHP 5 are not standard in PHP4 and vice-versa, so you might find that some functions won't work in one version that work in the other (this can also happen from one server to another running identical versions of PHP because a lot of functionality comes from exteral libraries.

    In shared hosting environments, I think PHP4 is more common, but PHP5 is slowly starting to catch up (I still have one server I use that runs PHP3...ugh!).

    I'd say start with either version. Once you understand the basics figuring out the differences between versions 4 and 5 should't be too difficult. As you start to learn PHP you'll quickly notice that it has a lot of similarities to Perl, so you should be able to get up to speed pretty quickly.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    Loyal Client
    Join Date
    Jun 2004
    Posts
    101
    Thanks, Jason, that helps. My gut was telling me I should start with the latest version, but with Jag (and it sounds like most hosts) running PHP4 on most machines right now, it would certainly be easier just to start with it and graduate if and when I start feeling any pain.

    Thanks,
    Mike

  4. #4
    Loyal Client
    Join Date
    Sep 2001
    Location
    Wichita, KS
    Posts
    1,647
    What's wrong with Perl :P

  5. #5
    Ron
    Ron is offline
    Loyal Client
    Join Date
    Aug 2002
    Posts
    7,304
    Why not COBOL, FORTRAN or BASIC??

  6. #6
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Or assembler? All those fancy programming languages are just a...let's not go there again.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  7. #7
    `':\_jmkogut_/:'`
    Join Date
    Mar 2006
    Location
    Ohio
    Posts
    22
    Quick answer, (basically, a rip of what Jason said earlier):

    PHP4 and PHP5 are still PHP. They both still use the same C-like syntax, and pretty much everything that works in PHP4 will also work in PHP5. PHP5 has alot of extra functions that help simplify common tasks (like, glob() for instance), and again, the OO is greatly improved.

    I would recommend PHP5, beings how JPC is migrating to it (or has already finished, I'm not sure) And, you can request to be migrated to hero, if you want PHP5 now.
    .:.::Web technologies demo::.:..
    http://www.dottru.com/

  8. #8
    Loyal Client
    Join Date
    Jun 2004
    Posts
    101
    Thanks. Since I generally like to be as up to date as possible, I decided to go ahead with PHP5. However, I'm having a bear of a time getting mysql installed and working with PHP5. Configuration errors, I suppose...

    Thanks for your thoughts.

    Mike

  9. #9
    `':\_jmkogut_/:'`
    Join Date
    Mar 2006
    Location
    Ohio
    Posts
    22

    mysql

    Which platform are you installing MySQL on? If it's on a system with apt-get, installation should be ridiculously easy. If it's on Windows, then you need to copy the DLL (mysqllib.dll, I believe) from your /mysql/bin/ dir to your /apache/bin/ dir then, configure the path to your extensions in php.ini to "./ext", not "./" finally, un-comment the line that enables the mysql extension, you should be good to go
    .:.::Web technologies demo::.:..
    http://www.dottru.com/

  10. #10
    Loyal Client
    Join Date
    Jun 2004
    Posts
    101
    Quote Originally Posted by jmkogut
    Which platform are you installing MySQL on?
    Windows XP

    Quote Originally Posted by jmkogut
    If it's on a system with apt-get, installation should be ridiculously easy. If it's on Windows, then you need to copy the DLL (mysqllib.dll, I believe) from your /mysql/bin/ dir to your /apache/bin/ dir then,
    It's libmySQL.dll and my understanding is that it goes in the /php/ directory (although I tried the /apache/bin/ dir as per your suggestion, to no avail).

    Quote Originally Posted by jmkogut
    configure the path to your extensions in php.ini to "./ext", not "./" finally, un-comment the line that enables the mysql extension, you should be good to go
    I did this as well, however I'm using php_mysqli.dll, as per the documentation. I do feel that this file has something to do with my problem. I've read many different things about which file I should be using (actually, filename, as it is the same file) and where it should go. As I move the file to different locations and indeed change its name or even put both files in various directories, I get varying errors. I realize what I'm telling you is a bit confusing, but that's because I'm a bit confused right now. I have read and tried many things, so I've lost track of exactly where I am, but more importantly, where I should be.

    My installation is as follows:

    Apache 2.0.49
    PHP 5.1.2
    mySQL 5.0.19
    Windows PATH system variable - ";c:\php\"


    Should I be using php_mysqli.dll, php_mysql.dll or both? Which directory(s) should the file(s) be in; \php\ or \apache\bin\?

    Once I get the file(s) in the correct place, I can then post the errors I get with that config.

    Thanks for your help,
    Mike

  11. #11
    Loyal Client
    Join Date
    Jun 2004
    Posts
    101
    I'm not sure what I did differently, but I revisited each step, enabled both php_mysql.dll and php_mysqli.dll and made sure the correct version of libmySQL.dll was in my \php\ directory, and it seems to be working fine now.

    Thanks,
    Mike

  12. #12
    `':\_jmkogut_/:'`
    Join Date
    Mar 2006
    Location
    Ohio
    Posts
    22
    You sir, give me a headache.

    Try installing a WAMP package, then examining that package's installation to firgure out how it works. That's how I learned it...

    WAMP is a good package, it's small, lean, and easy to dissect
    .:.::Web technologies demo::.:..
    http://www.dottru.com/

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
  •