To install PHP, We have to installed AMP(Apache, MySQL and PHP) software. There are various AMP software available in the market.
- XAMPP (Cross-Platform, Apache, MySQL, PHP and Perl) for windows.
- WAMP (Windows, Apache, MySQL and PHP) for windows.
- LAMP (Linux, Apache, MySQL and PHP) for Linux.
- MAMP for Mac.
- SAMP for Solaris.
- FAMP for FreeBSD.
Note: In this tutorial, we are using XAMPP software.
Follow these steps to run our PHP code.
- Download AMP (Apache, MySQL and PHP)software.
- Install it inside “C” drive.
- Open directory “C:\xampp\htdocs”.
- Create your own folder “phpfolder” inside the directory.
- Now, write your php code inside the phpfolder and save it with “index.php”
- Now open browser and write: “http://localhost/phpfolder/”.
Download AMP software.
You can download and Install server.
- Click here to download XAMPP Server ( for Windows )
- Click here to download WAMP Server ( for Windows)
- Click here to download LAMP Server ( for LAMP)
- Click here to download MAMP Server ( for MAMP)
Double click to install.
You can install it inside the “C” drive.
Open your directory: “C:xampp/htdocs”.
Now, create “phpfolder” folderand save it inside the given above directory.
Write simple PHP Code.
Now,write a simple program and save it “index.php” inside the directory: C:\xampp\htdocs\phpfolder.
Open your Browser like Chrome, Firefox etc.
You can run your php code by writing given code in browser url: http://localhost/phpfolder/.
Note: By default “index.php” page will be executed, when you call your project folder name.