5.4. Testing Your Development Environment

After you install the XAMPP package and start Apache and MySQL, your environment should be ready to go. You can test your installation by performing the following in any order:

  • Opening the XAMPP Web page

  • Opening phpMyAdmin

  • Running a test PHP script

5.4.1. Opening the XAMPP Web page

To test the XAMPP installation, follow these steps:

  1. Open a browser.

  2. Type localhost in the browser's address bar.

    In some cases, if your local machine isn't set up to recognize localhost, you might need to type 127.0.0.1 instead.


    An XAMPP Web page displays, providing a choice of languages. In some cases, XAMPP has already set your language choice and doesn't ask again. In this case, you don't need to do Step 3 because your browser is already at the page shown in Figure 5-7.

  3. Click your preferred language.

    The XAMPP Welcome page displays, as shown in Figure 5-7.

    If the Web page doesn't display, Apache may not be running. Use your Control Panel to manage Apache, as described in the previous section.

    Notice the PHP Switch link in the bottom section of the left panel. You can use this link to change PHP versions between PHP 4 and PHP 5.


    Figure 5-7. The XAMPP Welcome page.
  4. Click the Status link in the panel on the left side of the page.

    A list of software appears, showing which software is activated. MySQL and PHP should be listed as activated. Apache isn't listed because if Apache isn't running, you can't see this page at all.

5.4.2. Testing phpMyAdmin

From the XAMPP Welcome page (see the preceding section), you can open phpMyAdmin to test whether it's installed. Click the phpMyAdmin link in the Tools section toward the bottom of the left panel. If phpMyAdmin is installed, it opens in your browser. Book III, Chapter 1 explains how to use phpMyAdmin.

If the phpMyAdmin page doesn't open, be sure Apache is started. You can manage Apache as described in the "Using the XAMPP Control Panel" section, earlier in this chapter.

5.4.3. Testing PHP

To test whether PHP is installed and working, follow these steps:

  1. Locate the directory in which your PHP scripts need to be saved.

    This directory and the subdirectories within it are your Web space. This is the space where Apache looks for your scripts when you type localhost. This directory is called htdocs and is located in the directory where you installed XAMPP, such as c:xampphtdocs.

    You can change the location of your Web space in the Apache configuration file. Changing Apache configuration is described in the section, "Configuring Apache," later in this chapter.

  2. Create a text file in your Web space with the name test.php.

    The file should contain the following content:

    <html>
    <head><title>PHP test</title></head>
    <body>
    <?php
       phpinfo();
    ?>
    </body></html>

  3. Open a browser and type localhost/test.php into the address bar.

    The output from this PHP script is a long list of settings and variables for your PHP installation, as shown in Figure 5-8.

    Figure 5-8. Output from the PHP script.
  4. Scroll down the list to find a section of settings for MySQL.

    The software sections are listed in alphabetical order, starting with bcmath. The MySQL sections are located about half way down the list. You find two blocks, one headed mysql and one headed mysqli. The difference between mysql and mysqli is explained in Chapter 2 of this minibook.

    When your PHP script runs correctly and the output includes a block of settings for MySQL support, your environment is ready for your development work.

    If the PHP script doesn't run, be sure Apache is started. You can manage Apache as described in the "Using the XAMPP Control Panel" section, earlier in this chapter.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.255.127