PHP Tutorials - Herong's Tutorial Examples - v5.19, by Herong Yang
Downloading and Installing PHP on Linux
This section provides a tutorial example on how to download and install the PHP engine on Linux computers.
The PHP engine is pre-installed on most Linux computers. There is no need to run any command to download and install it.
For example, PHP 7.2 is available on my Ubuntu 18 computer by default:
herong$ php -v PHP 7.2.24-0ubuntu0.18.04.17 (cli) (built: Feb 23 2023 13:29:25) (NTS) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-0ubuntu0.18.04.17, Copyright (c) 1999-2018, by Zend Technologies
The same version of PHP engine is also available on my CentOS 8 computer:
herong$ php -v PHP 7.2.24 (cli) (built: Oct 22 2019 08:28:36) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
If the PHP engine is not available on your Linux computer, just download and install it with the software package manager as shown below:
# on Ubuntu or Debian computers sudo apt install php # on Fedora, RHEL or CentOS computers sudo dnf install php
Table of Contents
►Introduction and Installation of PHP
Downloading and Installing PHP on Windows
►Downloading and Installing PHP on Linux
Downloading and Installing PHP on macOS
"php -help" - Command Line Options
"php -i" - PHP Engine Information
php.ini - PHP Runtime Configuration
Hello.php - My First PHP Script
"php -a" - PHP Interactive Shell
Downloading and Installing PHP Documentation
PHP Data Types and Data Literals
Variables, References, and Constants
Expressions, Operations and Type Conversions
Conditional Statements - "if" and "switch"
Loop Statements - "while", "for", and "do ... while"
Function Declaration, Arguments, and Return Values
Interface with Operating System
Introduction of Class and Object
Integrating PHP with Apache Web Server
Retrieving Information from HTTP Requests
Creating and Managing Sessions in PHP Scripts
Sending and Receiving Cookies in PHP Scripts
Controlling HTTP Response Header Lines in PHP Scripts
Functions to Manage Directories, Files and Images
Localization Overview of Web Applications
Using Non-ASCII Characters in HTML Documents
Using Non-ASCII Characters as PHP Script String Literals
Receiving Non-ASCII Characters from Input Forms
"mbstring" Extension and Non-ASCII Encoding Management
Managing Non-ASCII Character Strings with MySQL Servers
Configuring and Sending Out Emails
Managing PHP Engine and Modules on macOS