Sep 28, 2017 With Apples’ new macOS High Sierra 10.13 available for download, here is how to get the AMP stack up and running on the new macOS. This tutorial will go through the process on getting Apache, MySQL, PHP (or otherwise known as the ‘AMP’ stack) and phpMyAdmin running on the new mac OS High Sierra. Many website owners use PHP with their websites to expand the capabilities of the sites. Before you can enable PHP on a Mac, you first have to enable Apache. Both PHP and Apache are free open source software programs and both come installed on all Macs. PHP is server-side software, and Apache is the most widely used web server software.
macOS Mojave ships with PHP 7.1, High Sierra 7.1, Sierra ships with PHP 5.6, OSX 10.11 El Capitan with PHP 5.5.x, there is an easy upgrade method to either the latest PHP version 7.3 or 7.2 or you can also go back to the older stable version 5.6.
PHP versions 5.5 and older are now considered end of life, with 5.6 and version 7.1 these will be the end of life in December 2018.
With the new macOS Mojave & High Sierra they already come shipped with PHP7.1.
The latest PHP version in this guide is from this PHP Packaged site which is being maintained for macOS and is known as a reliable source.
Download and Install PHP 7.3, 7.2, 7.1 or 7.0
Open Terminal and run…
or for 7.3
or for 7.2
or for 7.1
or for 7.0
You get a warning error for if the php is a newer version
The version is filed in /usr/local/php5 – Test the php version by creating a php file named phpinfo.php in your web root with the single function: Php For Mac Sierra Pro
Browse to that file and see the version displayed.
If instead you just want to just update to the latest 5.6 PHP…
Open the Terminal and issue one command –
That’s it! One line command in the terminal, this will download and install PHP5.6 in:
Apache Configuration
For either PHP version install 7.3, 7.2, 7.1 or 5.6 etc, the install script will also disable the previous PHP5.5 if it was enabled in the Apache configuration file /etc/apache2/httpd.conf . The new version is enabled in Apache right off the bat, the new install will comment out the older PHP module.
It will load the new PHP version via the /etc/apache2/other/+php-osx.conf file.
So to reverse the behavior uncomment the older PHP module in httpd.conf and remove the new config in other.
PHP stands for HyperText Preprocessor is a server-side programming language. Originally it was developed for web development but now is also used as a general-purpose language. It was created by Rasmus Lerdorf in 1994. This tutorial will help you to install PHP on macOS.
Prerequisites
Before starting the installation of Node.js and NPM using this tutorial you must have the following prerequisites
.
Download and Install PHP on macOS
The latest version of macOS Sierra ships with PHP 5.6 and similarly OSX 10.11 El Capitan with PHP 5.5, OSX 10.8 Mountain Lion ships with PHP version 5.3. The latest version of PHP 7.2 is available to install. The below steps to help you to install PHP 7.2 or 7.1 or 5.6 on macOS.
Open a terminal and run below commands
Install PHP 7.3
Install PHP 7.2
Install PHP 7.1
Php For Mac Sierra Update
Install PHP 5.6 – Running with OSX 10.11 El Capitan or lower versions.
Verify PHP Installation
The PHP versions for macOS are maintained by php-osx and doesn’t overwrite the current php binaries installed on your system. The installs everything in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php.
To verify the correct version of PHP is installed on your system, Execute the following command.
Also, create a phpinfo.php under your web root directory with the following contents and access the file in web browser.
Php Install Mac SierraRevert PHP to Default
Don’t you need the latest installed PHP? Simply edit the /etc/apache2/httpd.conf and uncomment below the line.
From:
to
And delete the files +php-osx.conf and +entropy-php.conf from /etc/apache2/other directory.
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |