Sunday, February 7, 2010

Installing a local server for PHP Testing purposes

Hello everyone,

A local server on you computer is very handy for testing purposes. It allows you to test your website, before it goes live to the public. However, some features may need to be tested on a live website if your local server can not handle them.

Apache (totally free) is a good server for testing PHP code on your computer. When you become better at PHP you might go into the realm of databases such as MySQL, and you will require a database for you local server so you can test database operations.

So, I would recommend XAMPP which is totally free like Apache but self installs itself, which a MySQL database as well. This saves you the time of trying to install these services separately. It would only take a few minutes after you click install, and it will be installed on your computer.

On most Windows based computers XAMPP will be installed in a folder called "XAMPP" on your C Drive, or which ever hard drive was selected in the installation. Open the "htdocs" folder from within the "XAMPP" folder and thats where you put your PHP website files, and other files required for your website to run.

To run your website after you have put the files necessary into the "htdocs" folder, open Internet Explorer, Firefox or another internet browser, and type into the address bar the website called http://localhost then press "enter". The website should now load up.

Please Note: The default webpage within the "htdocs" folder when the website http://localhost is opened. The default webpage is most commonly a file similar to the following:
  • index.htm
  • index.html
  • default.htm
  • default.html
  • index.php
  • default.php
other options exist for default webpages but they are some of the main ones.

Good Luck!

Don't forget comment if you have questions, or statements.

No comments:

Post a Comment