PHP Version Pre-Installed on macOS

This section provides notes to verify PHP version supported on macOS and run a simple PHP interactive scripting session.

macOS comes with PHP engine pre-installed. Here is what I did to verify the PHP version and program file location:

1. Start a Terminal and run "php -version" to see the PHP version number:

herong$ php -version
PHP 5.6.30 (cli) (built: Feb  7 2017 16:18:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies

2. Run PHP scripts interactively:

herong$ php -a
Interactive shell

php > print "Hello world!\n";
Hello world!

php > exit

3. Verify PHP program file locations:

herong$ which php
/usr/bin/php

4. Get a detailed list of modules supported in PHP:

herong$  php -i | more
phpinfo()
PHP Version => 5.6.30

System => Darwin local 16.7.0 Darwin Kernel Version 16.7.0:
   Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Build Date => Feb  7 2017 16:11:14
Configure Command =>  '/Library/Caches/com.apple.xbs/Binaries/apache_mod_php
   /apache_mod_php-117.2~3/TempContent/Objects/php/configure'
   '--mandir=/usr/share/man' '--infodir=/usr/share/info'
   '--disable-dependency-tracking' '--sysconfdir=/private/etc' ...

Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /etc
Loaded Configuration File => /etc/php.ini

curl

cURL support => enabled
cURL Information => 7.54.0
Age => 3
Features
AsynchDNS => Yes
CharConv => No
Debug => No
...

Table of Contents

 About This Book

 Introduction and Installation of PHP

 PHP Script File Syntax

 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

 Arrays - Ordered Maps

 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

 Managing File Upload

 MySQL Server Connection and Access Functions

 Functions to Manage Directories, Files and Images

 SOAP Extension Function and Calling Web Services

 SOAP Server Functions and Examples

 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

 Parsing and Managing HTML Documents

 Configuring and Sending Out Emails

 Image and Picture Processing

 Managing ZIP Archive Files

Managing PHP Engine and Modules on macOS

PHP Version Pre-Installed on macOS

 Upgrade PHP Engine on macOS

 Managing PHP Engine and Modules on CentOS

 Archived Tutorials

 References

 Full Version in PDF/EPUB