Page 59 - Beginning PHP 5.3
P. 59

Chapter 2: Your First PHP Script































                               Figure 2-11

                           If you see a 404 or a Connection Refused error, check your document root folder location and server
                         configuration as described in  “ Testing the Web Server. ”  On the other hand, if you get a Save As dialog, it
                         means that either PHP isn ’ t installed properly, or the Apache Web server doesn ’ t know about the
                         installed PHP module. Check the documentation that came with your package.

                           Setting Your Time Zone

                           Before leaving the topic of installation and testing, there ’ s one more thing you need to do, and that ’ s
                          configure your PHP installation to use the correct time zone.

                            For older versions of PHP, setting the time zone was less important; if you didn ’ t specify the time zone,
                          the PHP engine would attempt to work it out by querying the server it was running on. However, this
                          process was somewhat unreliable and is no longer recommended. Therefore, as of PHP 5.3, the engine
                          complains with a warning message if you try to use any of the date - related features of PHP without
                          having first configured your time zone.

                            Fortunately, setting your time zone in PHP is relatively straightforward. To do it, follow these steps:
                               1.       First look to see if the time zone is already set. Look at the page produced by the testing.php
                                script you just created, and find the date.timezone entry (it will probably be around halfway
                                down the page). If the Master Value column contains no value or an incorrect time zone, you
                                need to set your time zone, so proceed to Step 2. However, if the column contains the correct
                                time zone for your server (such as America/Los_Angeles), PHP ’ s time zone is already set cor-
                                rectly and you can skip the remainder of these steps.



                                                                                                          21





                                                                                                      9/21/09   8:50:23 AM
          c02.indd   21
          c02.indd   21                                                                               9/21/09   8:50:23 AM
   54   55   56   57   58   59   60   61   62   63   64