PHP Tutorials - Herong's Tutorial Examples - v5.18, by Herong Yang
PHP Version Pre-Installed on CentOS
This section provides notes to verify PHP version supported on CentOS and run a simple PHP interactive scripting session.
CentOS comes with PHP engine pre-installed. Here is what I did to verify the PHP version and program file locations:
1. Run "uname -mprsv" to confirm the Linux version. The output shows that I am running Linux 4 with CentOS 8 (el8):
herong$ uname -mprsv Linux 4.18.0-147.el8.x86_64 #1 SMP Wed Dec 4 21:51:45 UTC 2019 x86_64 x86_64
2. Run "php -version" to see the PHP version number:
herong$ php -version PHP 7.2.11 (cli) (built: Oct 9 2018 15:09:36) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
3. Run PHP scripts interactively:
herong$ php -a Interactive shell php > print "Hello world!\n"; Hello world! php > exit
4. Verify PHP program file locations:
herong$ which php /usr/bin/php
5. Verify PHP installation package information:
herong$ dnf info php CentOS-8 - AppStream ... CentOS-8 - Extras ... Installed Packages Name : php Version : 7.2.11 Release : 2.module_el8.1.0+209+03b9a8ff Architecture : x86_64 Size : 5.5 M Source : php-7.2.11-2.module_el8.1.0+209+03b9a8ff.src.rpm Repository : @System From repo : AppStream Summary : PHP scripting language for creating dynamic web sites URL : http://www.php.net/ License : PHP and Zend and BSD and MIT and ASL 1.0 Description : PHP is an HTML-embedded scripting language. PHP attempts to make it : easy for developers to write dynamically generated web pages. PHP also : offers built-in database integration for several commercial and : non-commercial database management systems, so writing a : database-enabled webpage with PHP is fairly simple. The most common : use of PHP coding is probably as a replacement for CGI scripts. : : The php package contains the module (often referred to as mod_php) : which adds support for the PHP language to Apache HTTP Server.
Table of Contents
Introduction and Installation of PHP
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
►Managing PHP Engine and Modules on CentOS
►PHP Version Pre-Installed on CentOS
Install PHP Extensions on CentOS
PHP Version Pre-Installed on CentOS 6