PHP: Installation
- Ameni OUERTANI
- Oct 27, 2018
- 5 min read
Updated: Oct 28, 2018

General Installation Considerations:
Before starting the installation, first you need to know what do you want to use PHP for. There are three main fields you can use PHP, as described in the What can PHP do? section:
Websites and web applications (server-side scripting).
Command line scripting.
Desktop (GUI) applications.
PHP runs on the server and its role is to generate web pages. However, only one server can read PHP; but your computer is not a server.
You'll temporarily turn your computer into a server so you can run PHP and work on your dynamic site. You will be ready to program after reading this chapter!!
For the first and most common form, you need three things: PHP itself, a web server and a web browser. You probably already have a web browser, and depending on your operating system setup, you may also have a web server (e.g. Apache on Linux and macOS; IIS on Windows). You may also rent webspace at a company.
In order for your computer to read PHP, it must behave like a server. You do not need to buy a special machine for this: just install the same programs that are found on servers that deliver websites to users.
What programs are we going to need, what are they?
Apache: This is called a web server. This is the most important of all programs, because it is he who is responsible for delivering web pages to visitors. However, Apache only manages static websites (it can only handle HTML pages). It must be supplemented with other programs.
PHP: it is a plug-in for Apache that makes it capable of processing dynamic web pages in PHP. Clearly, by combining Apache and PHP, our computer will be able to read web pages in PHP.
MySQL: it's the database management software I talked about in the introduction. It allows you to save data in an organized way (like the list of members of your site). We will not need it immediately, but install it right away.
All these elements that will help us create our dynamic site are free and free. While there are others (sometimes paying), but the combination Apache + PHP + MySQL is the most common on web servers, so much so that we created ready-made "packs" that contain all these elements.
In the rest of this chapter, we will see how to install the appropriate "package" according to your operating system (In our case Windows).
There are several packages ready for Windows. I propose you to use WAMP Server which has the advantage of being regularly updated and available in French.
Start by downloading WAMP here.
Check that you are taking a version of WAMP with PHP 5.4 minimum. The PHP features change from one version to another and this course is based on PHP versions> = 5.4.
Preferably, now rely on PHP 7.
Once downloaded, install it leaving all the default options. It should be installed in a directory like C: \ wamp and create a shortcut in the Start menu.
When you start WAMP, an icon should appear at the bottom right of the taskbar, next to the clock.
If a window appears to indicate that the firewall is blocking Apache, click Allow Access (. You have no reason to worry, it's perfectly normal.
You can then launch the WAMP home page. Left-click on the WAMP icon then click Localhost, as shown in the following figure.
A web page should open in your favorite browser (Firefox, for example). If the page appears at home, it means that Apache is working.
The web page you see on the screen has been sent to you by your own Apache server that you installed together with WAMP. You are simulating the operation of a web server on your own machine. For the moment, you are the only Internet user able to access it. We say that we work "locally". Note that the URL displayed by the browser in the address bar is // localhost /, which means that you are browsing a website located on your own computer.
The "Your Projects" section of the WAMP homepage should state that no projects exist at this time. Consider that every website you undertake to do is a new project.
As you already know, to edit the code of a web page you have several solutions:
use a simple text editor that you already have, like Notepad++. To open it, startStart / Programs / Accessories / Notepad. This software is usually enough to write web pages in HTML and even in PHP, but ...
the best is to use specialized software that colors your code (very practical) and which numbers your lines (very practical too). There are hundreds and hundreds of free software made for developers like you. I will present two here: a free (Sublime Text) and a payed (PHPStorm).
Sublime Text (free):
Whether you are on Windows, Mac or Linux, I recommend that you start with the Sublime Text editor which is light and simple enough for us to start
I suggest you install software that will allow you to edit your source files effectively. You probably have already installed one if you have learned to program in HTML / CSS, but as we are never too careful, I will quickly introduce you some depending on your operating system.
Do not be fooled by its apparent simplicity: Sublime Text is indeed fast and simple at the base, but it is possible to extend its functionality with countless plugins!
Sublime Text is a very good editor, used by many developers (including pros). However, he sees his limits on big projects, where some pros prefer him PHPStorm.
PHPStorm (paying):
PHPStorm is a little more like a "war machine" than Sublime Text. And for good reason: it's an IDE, a developer working environment. It is used by many professional PHP developers of my knowledge.
PHPStorm is more "beefy" than Sublime Text. It takes longer to load, it can have many advanced features through its plugins ... Moreover, PHPStorm is paying.
You may not start right away with PHPStorm, but keep it on your radar as it is a very used tool that you will surely try one day.
If you are also interested in using PHP for command line scripting (e.g. write scripts autogenerating some images for you offline, or processing text files depending on some arguments you pass to them), you always need the command line executable. For more information, read the section about writing command line PHP applications. In this case, you need no server and no browser.
With PHP you can also write desktop GUI applications using the PHP-GTK extension. This is a completely different approach than writing web pages, as you do not output any HTML, but manage windows and objects within them. For more information about PHP-GTK, please » visit the site dedicated to this extension. PHP-GTK is not included in the official PHP distribution.
PHP source code and binary distributions for Windows can be found at » http://www.php.net/downloads.php.
Comments