To run PHP scripts on any machine(server, computer etc) we need PHP installed on it. In this tutorial, we will learn how to install PHP on our computer/laptop and setup the development environment.
To run PHP scripts, we need the following services:
Now, you can install all the 3 services separately yourself, or you can simply download and install softwares which automatically installs all the above services.
The most popular such software package is XAMPP.
XAMPP stands for:
X: Cross Platform, as it supports all the moder operating systems like Windows, Mac OSX, Linux etc.
A: Apache Web Server
M: MySQL database management system.
P: PHP installation
P: Perl scripting language
You can easily download and install XAMPP from this link. The installation process is simple and once installed you will see a small window like this, showing the status of various services which are running.
You can easily control, stop and restart, various services using the XAMPP Control Panel.
Upon successful installation, a folder with name xampp will be created in the C drive(by default). In the folder xampp there are many sub-folders like apache, cgi-bin, FileZillaFTP etc, but the most important sub-folders are:
If everything seems fine and the apache server is running(check in the XAMPP control panel), open your Web browser and enter
localhost in the address bar and hit enter. You will see the default page of Apache web server.
XAMPP is not the only available package, although it is the most widely used one. Here are a few other Operating System specific options that you can download and install:
As PHP code is not compiled, you can even use a simple editor like Notepad to create PHP code files. But it's always good to have a nice looking Editor which can highlight the code, provide you suggestions while coding, and even analyze your code for syntax errors as your write it.
Before we checkout the list of IDEs and Editors, we must know the difference between both. An Editor is a simple text editor with enhanced capabilities like syntax highlighting etc, many modern editors also allows for language specific plugin download to support more features.
Whereas, an IDE is an integrated development environment, which is a self-contained package that allow you to write, compile, execute and debug code in the same place.
So if you want a light weight software, go for any Editor, and if you want a heavy weight IDE, you can choose any one from the list below.
So here are a few good IDEs and Editors:
Download and install anyone you want. I personally use Atom Editor, as it is lightening fast, comes with some amazing themes options and plugins.