What you need to run PHP on your computer and how to setup a WAMP server is explained in this tutorial.
What You Need to Run PHP
To run PHP code, you need the following three software on your local machine:
- Web Server (e.g., Apache)
- PHP (Interpreter)
- MySQL Databases (optional)
You can separately install Web Server, PHP Interpreter, and MySQL databases, but to make work easier, developers have made all-in-one setup packages called WAMP, LAMP, MAMP, and XAMPP, which will automatically install and set up a PHP environment on your Windows, Linux or MAC machines.
- WAMP (Windows, Apache, MySQL, PHP)
- LAMP (Linux, Apache, MySQL, PHP)
- MAMP (MAC, Apache, MySQL, PHP)
- XAMPP (Windows/Linux/MAC, Apache, MySQL, PHP)
Start Where?
To execute PHP code, you need access to a web server where PHP runs.
Your main options are:
- Install Apache and PHP or Install WAMP, LAMP, MAMP, or XAMPP according to your OS.
- After installation, you need to run and start the Apache Server and PHP from your program list and then type http://localhost in your web browser to start working.
- In the Apache installation folder, you will find the www folder, where you can save PHP files and create your project folder inside the www folder.
or
- Find a web hosting plan with Apache, PHP, and MySQL support, and Run your PHP scripts on your Web host.
Installing WAMP Server
Creating the Script
You need to use a text editor program to write your code. All OS comes with one or more text editors, for example:
- Windows Notepad
- Vi or Emacs on Linux
- TextEdit on Mac OS X
Commercially, Adobe Dreamweaver, NetBeans, and Sublime Text are used to edit PHP code.