Test Apache Web and PHP application servers

Source: Internet
Author: User
Tags contains echo date php and php and mysql

  Testing the PHP installation (Macintosh)

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

However, when using a WEB server to work with the contents of PHP pages and MySQL databases, you must first configure the server so that it can use PHP and MySQL.

  To test your Apache Web server and your PHP application server, do the following:

1, configure the server as described in the articles on the Macromedia Web site.

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 is created at <b>
<?php echo Date ("H:i:s a", Time ());?>
</b> on the computer running php.</p>

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

4, copy this file to the/users/your_user_name/sites folder on the Macintosh.

The Sites folder is your Apache Web server personal root folder.

5, in your Web browser, enter the following URL, and then press RETURN:

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

The test page should open and display the time as follows:

The specified time is called dynamic content because it changes every time you request the page. Click the Refresh button on the browser to generate a new page with a different time.

  Note: Viewing the source code (View > View source files in Safari) confirms that the page does not use any client JavaScript to achieve this effect.

  If the page does not work as expected, check to see if the following errors may exist:

  • The file does not have a. php extension.
  • The URL contains a typing error. Check for errors and ensure that there are no slashes after the filename, such as http://localhost/~your_user_name/timetest.php/. Also ensure that your username is preceded by a tilde (~).
  • The page code contains a typing error.
  • The Apache server is not running. Open System Preferences, and in the sharing category, see if personal Web sharing is enabled.
  • After you test the server software, create a root folder for your Web application.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.