PHP Installation

php installation

Which softwares are required?

You need to install the following three softwares to run php projects-

  1. Web server
  2. PHP
  3. Database (ex. MySQL)

Where to install?

You can install PHP either of the following two-

  1. On web host or
  2. In your local computer

PHP installation on web host

As PHP is widely used scripting language and it is free, it is most likely that the web hosting plan you’re using has the web server installed on it already.

PHP installation on local computer

While developing PHP based websites; you want to run PHP in your local computer.  So, you need to install it locally. You can install PHP on local system in two ways-

  1. All-in-one package installation (which is the easier solution)
  2. Separate Installation
  1. All-in-one package installation: For many beginners installing PHP separately seems intimidating. To help them get started quickly, there are some popular all-in-one packages. You don’t have to install and configure PHP, or Apache, or MySQL. ,Choose your package according to your operating system.
    • WAMP: :  If you’re using Windows, then you can use WAMP which is short for Windows, Apache, MySQL, and PHP. You can download WAMP from here www.wampserver.com/en/.
    • MAMP: If you’re using MAC, then you can use MAMP which is short for MAC, Apache, MySQL, and PHP. You can download MAMP from here mamp.info/en/index.html.
    • XAMPP: If you’re using Linux, then XAMPP is the installation package for you. ‘X’ in XAMPP stands for Linux, Windows, Mac OS X or Solaris. That means you can install XAMPP in any of operating system. You can download XAMPP from here www.apachefriends.org/en/xampp.html
  2. Separate installation: In case you’re confident of installing PHP separately, here are the downloads for you.

Testing the Installation:

To test your installation, write one of the two lines in web browser.

  1. http://localhost
  2. http://127.0.0.1

It will tell you whether the web server is running or not.

By default, MySQL admin super user root has no password. Just like web server, any computer connected to your network can access your MySQL. So, you should set a password to your root user.

PHP file location on the server:

All the php files are stored in the web server’s root directory or sub directory within it. Depending on the different all-in-one packages that you’ve installed, here are the locations of the root directories-

  1. WAMP-C:\wamp\htdocs
  2. MAMP- Macintosh HD:Applications:MAMP:htdocs
  3. XAMPP- C:\xampp\htdocs

Note: Here it is assumed that you’ve installed the package in C drive.

‹‹ Course Overview : Previous Lesson Next Lesson : PHP Installation >>