Testing the PHP installation (Macintosh)

Testing the PHP installation (Macintosh)

You can test the Apache web server and PHP application server on your Macintosh by running a test page.

However, before you can use the web server to serve PHP pages and content from MySQL databases, you must configure the server to work with PHP and MySQL. For information on this process, see www.macromedia.com/go/php_macintosh.

To test the Apache web server and PHP application server:

  1. Configure the server as described in the article on the Macromedia website.
  2. In Dreamweaver or any text editor, create a plain text file and name it timetest.php.
  3. In the file, enter the following code:
    <p>This page was created at <b>
    <?php echo date("h:i:s a", time()); ?>
    </b> on the computer running PHP.</p>
    

    This code displays the time the page was processed on the server.

  4. Copy the file to the /Users/your_user_name/Sites folder on your Macintosh.

    This Sites folder is your personal root folder for the Apache web server.

  5. In your web browser, enter the following URL and press Return:

    http://localhost/~your_user_name/timetest.php

The test page should open and display a time of day.

The specified time is known as dynamic content because it changes every time you request the page. Click your browser’s Refresh button to generate a new page with a different time.

If the page doesn’t work as expected, check for the following possible errors:

  • The file does not have a .php extension.
  • The URL contains a typing mistake. Check for errors and make sure the filename is not followed by a slash, such as http://localhost/~your_user_name/timetest.php/. Also make sure you included the tilde (~) before your user name.
  • The page code contains a typing mistake.
  • The Apache server is not running. Look in System Preferences, in the Sharing category, to see whether Personal Web Sharing is enabled.

After testing and testing the server software, create a root folder for your web application. (See Creating a root folder (Macintosh).)



Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly