Hi! I'm new to programming in PHP. I had a site programmmer, but he left for parts unknown, so I'm learning it all myself. I might have a few questions. 🙂

I'm learning from several books, including "PHP 4.1" by Jeremy Allen and Charles Hornberger, as well as Larry Ullmans "PHP for the world wide web", Sams "Teach yourself PHP MySQL and APACHE in 24 hours", OReillys "PHP pocket reference", and "Practical PHP Programming" on the Hudzilla site.

My hosting website provider is currently running PHP 4.2. I thought it might be logical to start with 4.1 and move forward. I can use the MySQL DB I have with them to practice.

What might I be missing? I can afford to buy any relevant books, and I am planning on eventually buying or building my own server, once I learn how to install apache and some version of Linux.

    You might as well start with 4.2 (I'd say 4.4.2, the current version on the 4.x branch, but if your host is lagging behind in maintenance upgrades .... you can see just what is different between the versions here).

    But basically, install PHP (and optionally a web server) on your machine, bookmark the manual and get cracking!

      Since I have a book on 4.1 I thought I might as well make the most of it. Can't hurt, can it? Plus I do have a book that covers all the way up to ver. 5. I have so much to learn, I want to read it all.

      Also, instead of running php on my own machine, I will be running it on my remote hosted server, as part of a web project I am building as a training tool. I realize that makes an extra step or two but I don't know how to set up a win xp machine to run php at the same time, and I travel quite a bit.

        There is very little reason to run any version < 4.4.2 these days.

        If you don't have to support legacy applications, go straight for 5.1.2 - it will do what you want, the vast majority of the examples in the book will work anyway (Note that the OO stuff will be different though).

        4.2 is an elderly version and should not be used. 4.1 is mostly only of archaeological significance.

        Mark

          If you don't have to support legacy applications, go straight for 5.1.2

          PHP 5.1.3 was released on 1st May 2006, apparently.

            FatStratCat wrote:

            but I don't know how to set up a win xp machine to run php at the same time

            There are sections in the manual on doing that. I found that to "install" PHP all that was necessary was to download the zip and extract it to where I wanted it. I did a couple of other things (tweaked the configuration settings to taste, added the directory where php.exe resided to my path so's I could do shell scripting with it, that sort of thing). Later, installing Apache, while involving a bit more work, was still straightforward.

              laserlight wrote:

              PHP 5.1.3 was released on 1st May 2006, apparently.

              With a big bad bug.

              Consensus seems to be don't upgrade to 5.1.3, wait for the 5.1.4 release which should be along soon.

                I found that to "install" PHP all that was necessary was to download the zip and extract it to where I wanted it.

                Yeah, and the PHP manual gives the instructions needed for configuring the server too.

                Later, installing Apache, while involving a bit more work, was still straightforward.

                I installed Apache using their installer before installing PHP.

                Consensus seems to be don't upgrade to 5.1.3, wait for the 5.1.4 release which should be along soon.

                Unlucky number 1.3? :p

                  laserlight wrote:

                  I installed Apache using their installer before installing PHP.

                  I used that installer too (installing PHP first is just how it happened to come about in my case). By "a bit more work" I just mean adding the necessary declarations to httpd.conf 🙂

                    MarkR wrote:

                    There is very little reason to run any version < 4.4.2 these days.

                    If you don't have to support legacy applications, go straight for 5.1.2 - it will do what you want, the vast majority of the examples in the book will work anyway (Note that the OO stuff will be different though).

                    4.2 is an elderly version and should not be used. 4.1 is mostly only of archaeological significance.

                    Mark

                    What, essentially is the big difference between 4.2 and 4.4.2?

                    I use a fairly large service provider, and they're using 4.2.

                      A whole lot of nothing. Kinda. Really, there are bugs in everything, and 4.2 will have some that later versions don't. As for functionality, not a lot of difference, most likely. Most development is occuring in PHP 6 at this time.

                      Encourage your provider to upgrade, but gently. Truth to be told, what you write at first might have worked on PHP3; you never can tell. Books tend to lag behind; most of what you'll read would work, even in PHP5 (although 6 maybe a different story).

                      In particular, watch out for "register globals" (which should be OFF). However, IIRC, both the Ullman text and the SAM's book assume it is on (at least the versions I have ... YMMV; I know that the books do get upgraded from time to time. Example:

                      // form.html
                      <html>
                         <head>
                            <title>Submit your name</title>
                         </head>
                         <body>
                            <form method="post" action="handler.php">
                               Input your name:<input type="text" name="myname">
                               <input type="submit" value="Submit">
                            </form>
                         </body>
                      </html>
                      
                      // handler.php
                      
                      <?php
                         echo "Hello, $name";  // this will not work if "register_globals" is OFF
                         echo "Hello, ".$_POST['name']; // this will
                      ?>

                      Oh, and BTW: Welcome to PHPBuilder!

                      Also, show us your Strat ;-)

                        Shrike wrote:

                        With a big bad bug.

                        Consensus seems to be don't upgrade to 5.1.3, wait for the 5.1.4 release which should be along soon.

                        Or HEAD or PHP_5_1 from CVS ;-)

                        Hey, though. 21 hours from report to fix. We will not be seeing that from like, Microsoft anytime soon, will we?

                          What, essentially is the big difference between 4.2 and 4.4.2?

                          PHP 4.4 "addresses a serious memory corruption problem within PHP concerning references". In any case, you can just read the PHP4 changelog yourself.

                          In particular, watch out for "register globals" (which should be OFF).

                          Did a quick check on 4.2 in the changelog, and there's a "ATTENTION!! register_globals defaults to 'off' now !!!", so unless FatStratCat's host fiddled with the settings, there shouldnt be a problem of it leading to a bad habit.

                          Or HEAD or PHP_5_1 from CVS ;-)

                          No matter now, they just released PHP 5.1.4

                            dalecosp wrote:

                            Oh, and BTW: Welcome to PHPBuilder!

                            Also, show us your Strat ;-)

                            First a question, then the pics.

                            If my stuff is built using 4.2, and the provider upgrades to 5.2, will I have problems?

                            Now, the pics.

                            L to R Hamer Bass, Ibanez acoustic 6, American Deluxe "Fat Strat" Behind is a Roland Digital piano:

                            l to r Yamaha Acoustic, Marshall Half stack, Boss GT-6:

                            There you have it. 🙂

                              dalecosp wrote:

                              We will not be seeing that from like, Microsoft anytime soon, will we?

                              Bug? There is no bug...

                                I figured as much, but that's why I asked. Everyone here is smarter than I am when it comes to PHP. I have a stack of books to read, so I need all the help I can get.

                                You guys will probably hate me before too long with all the questions I will most likely have to ask, so let me apologize in advance for that.

                                  That's nice but still a lot of question, any way in this way you can learn much eays if you ask more and more..

                                    ...but first have a crack at finding out the answer for yourself. You learn more that way.