What a Pretty Hypertext Preprocessor (PHP)!
The marketing landing page for the PHP language is:
renowned voices in the PHP community, including Larry Garfield, Fabien Potencier, Nils Adermann, Elizabeth Barron,
Documentation
“Zend PHP Certified Engineer” is a well-known vendor-specific exam for PHP developers. For $200 for testing or $1295 with a class to Perforce,
“PHP Developer Fundamentals” exam from IC3 (administered by Pearson) is the entry-level PHP exam. Answer 70% of 40 questions over 50 minutes online Certiport Console 8. The IC PHP covers nine domains of knowledge and skill:
To add generative AI to PHP programs, you can use LLPhant, a comprehensive PHP Generative AI Framework using OpenAI GPT 4 Inspired by Langchain. Install it using command “composer require theodo-group/llphant”.
https://www.youtube.com/watch?v=lTr06V9uyts
If it’s installed, the version of PHP is obtained from this Terminal command:
php -v
If you get a response, see the Install section below.y
A Pretty Hypertext Preprocessor (PHP) was included by Apple on OS X (before MacOS):
On Mojave, the response was:
PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
On Sierra, the response was:
PHP 5.6.28 (cli) (built: Dec 6 2016 12:38:54) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
On Yosemite, the response was:
PHP 5.5.14 (cli) (built: Sep 9 2014 19:09:25) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
For the location of the PHP being used by the command line:
which php
On my Yosemite, the response is:
/usr/bin/php
Install using Homebrew:
yes brew install php
php -v
For example:
PHP 8.5.7 (cli) (built: Jun 2 2026 20:59:56) (NTS) Copyright (c) The PHP Group Built by Homebrew Zend Engine v4.5.7, Copyright (c) Zend Technologies with Zend OPcache v8.5.7, Copyright (c), by Zend Technologies
The history of PHP releases are at:
Scroll down to the latest (largest) version for “OS X” and click “Download” of the macOS installer (.dmg), not a VM image from:
https://www.apachefriends.org/download.html
The most popular PHP development environment is XAMPP, an acronym of components:
XAMPP is Windows-focused.
WARNING: Don’s use XAMPP to develop Nextcloud which officially doesn’t support Windows. You’ll fight with PHP extensions (gd, mysqli, mbstring), mod_rewrite, and permissions.
open -a manager-osx.app
Click “Configure”. Notice the port defaults to 3306.
Verify it works: Open a browser and go to: http://localhost:3306
You should see the XAMPP dashboard.
sudo /Applications/XAMPP/xamppfiles/xampp start && sleep 2 && echo "================ STATUS ================" && sudo /Applications/XAMPP/xamppfiles/xampp status
or individually:
sudo /Applications/XAMPP/xamppfiles/xampp startapache
sudo /Applications/XAMPP/xamppfiles/xampp startmysql
curl -sSI http://localhost/ | head -n 1 # Apache: expect "HTTP/1.1 200 OK" (or 3xx)
nc -z -v localhost 3306 # MySQL/MariaDB: "succeeded" = port open
nc -z -v localhost 21 # ProFTPD: FTP port
Install Visual Studio Code
from /Applications/XAMPP/xamppfiles/var/mysql) mysql-data-dir/my.cnf to set server-specific options
$c = ($f - 32) * (5 / 9);
echo $c from $f
semicolons after each statement
Numbers, Strings and Operators: single quotes between double quotes.
Attributes #[Attribute]
Control Structures
Predefined Exceptions
Context options and parameters
Video courses on PHP by Coursera: https://www.coursera.org/search?query=php
To activate PHP using the Pico text editor that comes with Macs:
sudo pico /etc/apache2/httpd.conf
Within pico, press Ctrl+W and type php to search for the php5_module statement.
Press cursor key left to the right of the # comment character, press the backspace key to delete it. PHP is activated after you press Ctrl+X and Ctrl+Y to confirm Yes.
Alternately, to activate PHP using the vi text editor that also comes with Macs:
sudo vi /etc/apache2/httpd.conf
To find php…
Press ‘x’ over the ‘#’ character to delete it.
Type ‘:w!’ to save. Type ‘ZZ’ (upper case) to quit.
Only for Yosemite, also uncomment line 166:
LoadModule userdir_module libexec/apache2/mod_userdir.so
And also line 493:
#Include /private/etc/apache2/extra/httpd-userdir.conf
To activate PHP using the pico text editor that comes with Macs:
cd /private/etc
Copy the default file to a .ini file:
sudo cp php.ini.default php.ini
For Yosemite only, open the file with:
sudo vi /etc/apache2/extra/httpd-userdir.conf
Uncomment line 16:
#Include /private/etc/apache2/users/*.conf
Save and exit.
Ensure that your user name is listed within:
ls -la /etc/apache2/users
In addition to the Guest.conf listed, there should be a .conf file with your Mac user name (mine is wilsonmar).
Such file may not be created while upgrading to Mountain Lion. Contents of this file is different on Yosemite:
<Directory "/Users/wilsonmar/Sites/"> AddLanguage en .en LanguagePriority en fr de ForceLanguagePriority Fallback Options Indexes MultiViews AllowOverride None Order allow,deny Allow from localhost Require all granted </Directory>
By popular convention, the Sites folder (with a capital S) is used to store website files. Create one under the default /Applications folder from the command line:
mkdir ~/Sites
Create a HTML file to display by default when no file is specified:
echo “<html><body><h1>My site works</h1></body></html>” > ~/Sites/index.html.en
/Library/WebServer/Documents/index.html.en . This contains the text “It works!”
Older versions of Apache had a UI in System Preferences > Sharing and enable Web Sharing. But on Yosemite:
Within a Terminal:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Check the version of Apache installed:
httpd -v
The response on my Yosemite is:
Server version: Apache/2.4.9 (Unix)
Server built: Sep 9 2014 14:48:20</tt>
See http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/
To add modules to PHP, add libmcrypt-2.5.8 and PHP source code from http://us.php.net/get/php-5.5.14.tar.gz/from/a/mirror using these instructions: http://michaelgracie.com/2011/07/21/plugging-mcrypt-into-php-on-mac-os-x-lion-10-7/
Building Web Applications in PHP from University of Michigan Best for: intermediate learners, students with months to commit, and those aiming to build full web applications with User Interfaces formatted using CSS.
Full-Stack Web Development: PHP, HTML, CSS & JavaScript from Board Infinity Best for: beginners interested in full-stack development, learners with a few months available, and those wanting a specialization credential
Building Database Applications in PHP from University of Michigan Best for: intermediate developers, learners focused on database skills, and those ready to enhance PHP with MySQL integration
Introduction to VueJS Framework from Codio Best for: beginners with 1-4 weeks availability, learners new to Vue.js, and those seeking foundational web development skills
The Complete Vue.js Course for Beginners from Packt Best for: beginners with 1-3 months to learn, those interested in JavaScript frameworks, and learners preferring comprehensive beginner courses
Vue.js 3 for Beginners: Build Modern Web Applications from Packt Best for: intermediate learners with 3-6 months commitment, developers focusing on modern web apps, and those wanting to master Vue.js 3 features
Fundamentals of VueJS from Board Infinity Best for: intermediate learners with short-term availability, web developers interested in JavaScript frameworks, and those aiming to strengthen Vue.js fundamentals
This is one of a series on Mac OSX:
26-06-13 v003 new from wilsonmar @macos-php.md created 2014-08-09