Skip to main content

PHP: Testing Your Environment

Now that you have installed all the required software (or your using a web host), we need to test your environment to see if it can actually run PHP code. We do this by creating a test file, add some code and navigate to that file via a web browser.

First thing we have to do is create a file named index.php. Once that is done add the following code:

<?php 
phpinfo(); 
?>

NOTE: Using the phpinfo() function will output a bunch of information about your PHP environment. Since it contains potentially important information, it is wise not to allow outside users to see it.

Save the file and move it to your web server's root directory.Once you have made the move open up your favorite web browser (Firefox, Safari, IE) and navigate to:

http://www.example.com/index.php (if your using a web hosting company)

or

http://localhost/index.php (if your working on your own computer)

If everything went correctly, you should see something like the image below.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <p><b><i><pre><a><img><em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><h1><h2><h3><h4><h5><h6>
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.

More information about formatting options

Premium Drupal Themes by Adaptivethemes