03 January 2011

Easiest Way to Setup PHP on Your PC

The very 1st step in learning PHP is to setup a PHP server on your PC, that enables you to test run your PHP coding. I believe there is a lot of guides and step by step, that you can find on the internet, on how to setup PHP on your PC, but the easiest one for me, is using EasyPHP (www.easyphp.org).

image

Simply browse to EasyPHP site (www.easyphp.org), and click on the DOWNLOAD button. It includes PHP, Apache, and also MySQL database. At the download page, you can simply choose the latest one, EasyPHP 5.3.4.0 (at the time of this writing, the latest version is 5.3.4.0, which includes PHP 5.3.4, Apache 2.2.17, MySQL 5.1.54, PhpMyAdmin 3.3.8.1 and Xdebug 2.1.0). The download takes about 2 minutes, size about 17.3MB (all in one package).

After the download complete, run the downloaded file. The installation should be simply Next, Next, Next, and remember to choose “Launch EasyPHP” before you click Finish. You should have an EasyPHP icon located at your tray icon if it is launched. Double click on that icon, and the EasyPHP status windows should pop out, showing the status of Apache, and MySQL. Both should be “Started” if everything goes accordingly. If you want to close this status windows, don’t click the “X” button, it will stop EasyPHP running on your PC, use the Minimize button instead.

image

So, if you follow the default installation of the EasyPHP, you should have the root directory installed at “C:\Program Files\EasyPHP-5.3.4.0\www\” or if you are using 64-bit windows, at “C:\Program Files (x86)\EasyPHP-5.3.4.0\www\”. Right click at the EasyPHP icon to reach the menu list, and from the menu list, you can reach the root directory by clicking on “Explore”, Administration page by clicking “Administration”, local web page by clicking “Local Web” and bla….

image

After you have Apache and PHP running on your PC, you can start your coding. If you have any doubt on the usability of Apache and PHP on your PC, you can simply run the test below.

Open the Local Web, it should fire up the default EasyPHP page, because the www root directory is still empty.

image

Using Notepad, create a file called “phpinfo.php” and put that file in the www root directory. Edit the newly created file and insert these line to that file:

<?php
    phpinfo();
?>
Now at the Local Web page, change the address “http://127.0.0.1:8888/” to ”http://127.0.0.1:8888/phpinfo.php” (or simply click at the link given here). You should reach a page with bunch of information about the installed PHP.

image


So, if you can see the page correctly, similar to the image above, then I guess you have completed the Installation and Configuration of Apache and PHP at your PC. Now you can start your PHP coding!

No comments:

Post a Comment