How to Install?



Requirements:

PHP
HTTP Server (Apache, Nginx, IIS)
Any web browser (Chrome, Opera, Mozilla)
Editor (Notepad ++, Visual Studio Code, Atom)

The setups for the operating system you are using vary. Here's how to set up the necessary technologies for PHP for Windows, Linux and MACOS operating systems .

 

# Section Headings


# Install as Package
# Windows
# MacOS

# Linux

Apache Installation
MySQL Installation
PHP Installation

# Editor Selection

 

 

# Install as Package


It is possible to install all components required for PHP installation for a given operating system in one package at a time. This is called XAMPP. This package consists of the following components.

Apache
MariaDB
PHP
Perl

Download: XAMPP

 

 

# Windows


In the Windows operating system, it is recommended to install the XAMPP package which installs the required technologies of PHP as a package. It is the best package to work on the Windows platform with the required server configuration. 

This package simply installs all of the above components at once. Click the link below to download this package.

 

After running the downloaded file, follow the steps below.

Next ... Next
Finish

After installation you will come up with a screen malfunction like the following. For Apache and MySQL, press start.

After all the installations, create the following file to understand if PHP is working properly.

File:  C: \ xampp \ htdocs \ info.php
 echo "Hello world!" ?>

To run, type the following link in the address bar of your web browser.

Run: http: //localhost/info.php
Hello world! 

 

 

# MacOS


In the Mac operating system, it is recommended to install the XAMPP package which installs the necessary technologies of PHP as a package. It is the best package to work on the Windows platform with the required server configuration. 

This package simply installs all of the above components at once. Click the link below to download this package.

 

 

# Linux


In this operating system , we will run the necessary setup for PHP through the console. You can download and install it as a package from the above link. With the order we will install the following modules components.

Apache
MySQL
PHP

Apache Installation

Apache is the most preferred and source HTTP server for PHP . We can begin with the following codes.

sudo apt-get update
sudo apt-get install apache2

After these commands, root will ask you for your password. Once you have entered your password, apt will tell you which packages you plan to install and how much disk space it will take. Press Y to continue and press Enter, installation will continue.

Firewall Permissions

To enable the UFW firewall, ensure that your firewall allows HTTP and HTTPS traffic.

sudo ufw app list
Available applications:
  Apache
  Apache Full
  Apache Secure
  OpenSSH

If you look at the "Apache Full" profile, you should show traffic to ports 80 and 443 :

sudo ufw app info "Apache Full"
Profile: Apache Full
Title: Web Server (HTTP, HTTPS)
Description: Apache v2 is the next generation of the omnipresent Apache web
server.

Ports:
  80,443 / tcp

 Allow incoming traffic for this profile:

sudo ufw allow in "Apache Full"

Run the following link to make sure that the steps we've taken are right.

Run: http: // localhost /

You'll see the Ubuntu 16.04 Apache web page, which is informative and testing.

MySQL Installation

Now that we have installed our web server, we will perform MySQL setup for our database operations. For beginners it is better to do the installation already, although it is not a preference of preference, but it is necessary during the progress of education.

sudo apt-get install mysql-server

A list of packages to be installed will be displayed along with the disk space to be reinstalled. Enter Y to continue .

During installation, your server will ask you to select and confirm a password for the MySQL "root" user. This is a management account with increased privileges in MySQL. Consider this as similar to the server's root account. Make sure your password is strong and unique, and do not leave it blank.

P H P Setup

Now I'm setting up PHP. We can use the apt system once more to set up the components. We will also include some help packages so that the PHP code can run under the Apache server and interact with your MySQL database.

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

After the above command, PHP will be installed.

Module Setup

To improve the functionality of PHP, we can optionally install some additional modules. To see currently installed PHP modules, you can run the following command.

sudo apt-cache search php- | less

You can search the internet for more information about what each module did, or you can do the following by typing in the long description of the package:

apt-cache show paket_adi

For example, to find out what the php-cli module does, we can write:

apt-cache show php-cli

If we do not decide that the php-cli module is something we need, we can write:

sudo apt-get install php-cli

If you want to install more than one module, you can list it by separating each with a space, by following the apt-get install command as follows:

sudo apt-get install paket1 paket2 ...

Installation Test

Restart apache after all setups.

sudo service apache2 restart

Create the following file to understand if PHP is working properly.

File:  /var/www/html/info.php
 echo "Hello world!" ?>

To run, type the following link in the address bar of your web browser.

Run: http: //localhost/info.php
Hello world! 

 

 

# Editor Selection


Editor selection is very important in terms of code development. The criterion for how well the editor will support the programming language you are using is the preserve.

 

A good editor should have the following features;

Programming language support
Debugging
Code coloring
Code completion
High performance
Wide range of add-on support
Large population

We recommend Visual Studio Code by our experiences on many different ones.