Friday 2 September 2011

PHP Tutorial- Setting Up PHP

SETTING UP PHP:-
To run php you will need the following softwares-
  • PHP 5.3(or the latest version available on php.net)
  • Web Server (like apache, IIS etc.)
  • MySQL server(optional)
You could either install each one of the above mentioned software separately and then manually set each one of them separately or you could simply install a software called WAMP(for Windows)/LAMP(for Linux) which includes all of the above softwares.

Installing WAMP (for Windows)/LAMP (for Linux distros like Ubuntu, Fedora, Knoppix etc.)
WAMP is a combined package that includes Apache Web server, MySQL Server and PHP in addition to some utility softwares for MySQL. It is recommended that you straight away just install WAMP/LAMP to set up your computer for PHP and MySQL. Here’s a simple brief guide for installation of WAMP/LAMP on Windows/Linux. If you are not able to follow the given steps then just search for it on the internet. Its very easy so you won’t really need to refer to some other place. But, just in case you are not able to install WAMP/LAMP just search for it on the net and don’t give up.

  • On Windows XP/Vista/7
    1. Download WAMP from http://www.wampserver.com/en/download.php. Depending on your OS version download the 32bit or 64bit version. Make sure you download the latest edition of WAMP Server which on the time of writing this tutorial is WAMP Server v2.1
    2. Run the WAMP installation and follow the onscreen instructions to install. (No need to change anything except for the installation path if required).
    3. To check that WAMP installed correctly open your Web Browser and type localhost in the address bar.
    4. If a page similar to the below image appears then PHP was correctly installed.
image

If you get an error saying “The Requested Page was not found” or any similar errors then make sure WAMP server is running. The WAMP icon on the right side of taskbar should look like clip_image004. If it appears like clip_image006 or clip_image008 it means your Apache server/MySQL server is not running. In such a case click on the WAMP icon and click on restart all services. If it doesn’t work still then try starting the apache server and MySQL server separately.

  • On Linux distros like ubuntu, fedora, knoppix etc.
    1. Open your terminal window and type the following command “sudo apt-get install lamp-server^”.
    2. When asked for the password, type it in and press enter.
    3. It will automatically be installed after that.
    4. To check if LAMP installed correctly open your browser and type localhost.
    5. If a page saying “IT WORKS!” loads then it means LAMP has been installed properly.

Now that WAMP/LAMP has been installed and working, we are ready to move on to learning PHP.

No comments:

Post a Comment