Introduction
PHP is a server-side scripting language. Originally it was designed for web development but it can also be used as a general-purpose language. It was created by Rasmus Lerdorf in 1994. Originally it stood for Personal home page but now It stands for Hyper Text Preprocessor. PHP code can be embedded into HTML. PHP is basically an interpreted language implemented by a web server or CGI executable. In this tutorial, we will learn the steps to install PHP on macOS.
Apple Mac OS X El Capitan Free VIEW →. OS X El Capitan features new options for managing windows, smarter Spotlight search, app enhancements, and faster performance. Step 8 is facial detection. Look at the camera and you should get a 'Success!' If not, try removing your glasses, hat, etc. Click 'Continue.' Step 9 allows you to begin your exam. Click 'Begin Exam.' You will be taken directly to your exam in Blackboard, and if there is a timer, it will begin. How to Install PHP on macOS Introduction. PHP is a server-side scripting language. Originally it was designed for web development but it can also be used as a general-purpose language. It was created by Rasmus Lerdorf in 1994. Originally it stood for Personal home page but now It stands for Hyper Text Preprocessor. PHP code can be embedded into.
Prerequisites
- MacOS
- Login as an administrator on terminal
- Homebrew package installer must be configured on the system.
Installation
1) Installation of PHP includes following steps.
Update the local repository index of Homebrew package installer
Following command can be used to update the local repository index of homebrew package installer.
2) Install PHP
The latest version of PHP is PHP 7.1. it can be easily installed with a single command as follows.
Get Firefox For Mac
In case, no similar formulae found, we need to tap into the other PHP repositories by running the following command.
PHP 7.1 is installed inside /usr/local/Cellar. In order to execute php globally, we need to set path in .bash_profile stored in the user's home directory. Open the file using VI editor and add the following line.
Verify PHP
To verify correct version of PHP is installed on our system, we can execute the following command.
![Php Php](/uploads/1/1/7/7/117766424/941437972.jpg)
Hence, we have successfully installed and get started with PHP version 7.1.12.
Next TopicHow to Install Python on Mac
Each Mac has a built-in Apache server that runs a built-in PHP.
To upgrade it you need less than 10 minutes once you have understood all the steps needed.
The same applies also to install the last PHP 7.1 version: you only need to change the required version of PHP (see below).
Exploring the LAMP server of a Mac
To understand the built-in PHP of your Mac the first thing you should do is open your terminal and type in:
This is the PHP version installed in your Mac.
But, from where is it executed?
And the php.ini?
So, by default Mac OsX has
PHP 5.5.24
with xDebug 2.2.3
and our php.ini
is located at /usr/bin/php
.How to update PHP on Mac OsX
As we want to update the built-in version of PHP of our Mac OsX, at this point maybe its better to think at a more valuable solution.
Update PHP… go to php.net/downloads.php, download the latest version of PHP, unzip, compile, configure… Mmm, there is a better solution for sure!
And in fact, those good boys at Liip have thought that there should be a better solution… And they built it!
So, in your Terminal, type (use 7.1 if you want to install the last PHP 7.1 version!):
You have just downloaded the best PHP latest version you can find ever.
Now, let’s configure it: it needs less then 5 minutes!
Php Ide Mac
WARNING: If you receive an error like, then you need to stop the built-in Apache instance and reinstall it from Homebrew: it seems the Apache version shipped with MacOS causes some troubles that prevent the server to starting.
Here all the information you need to disable the built-in version of Apache in MacOS and install a fresh new one with Homebrew.
Here all the information you need to disable the built-in version of Apache in MacOS and install a fresh new one with Homebrew.
How to configure your updated version of Mac OsX built-in PHP
The package you have just downloaded is a custom version of PHP built by Liip and it provides a lot more functionalities and useful PHP extension than the original Mac OsX built-in PHP, so you will save a lot of time when you’ll install and update them (think at Intl extension or xDebug, for example).
Once downloaded, the Liip’s PHP moves all the files into
/usr/local/php5-5.6.11-20150710-223902/bin
and makes a symlink of this folder called php5. In this way, when you’ll update PHP, Apache will automatically load the new PHP version (see more about this in a moment). Really smart!If you type in Terminal again
which php
you’ll get the same result as before. This is because we have to tell our Mac OsX to load PHP from the new location.To do this we will create a
.bash_profile
in our user directory:This will open VIM that will create the new file (if it is already present, type the letter
a
to enter the edit mode).Into the
.bash_file
write the line export PATH=/usr/local/php5/bin:$PATH
, then press Esc
and type SHIFT + Z
for two times (a shortcut to save and close the file).Then load again the
.bash_profile
file and restart Apache:You have updated your Mac OsX built-in PHP.
On the Liip’s PHP Mac OsX home page you will find a lot of useful information about your new PHP.
Install Php On Mac
The next step you should do is open the
php.ini
located at /usr/local/php5/lib/
and set it the right way.And, once you have configure your
php.ini
, maybe you want to configure your Mac Osx built-in Apache or want to install MySQL in your Mac (as it is not shipped by default).Remember to “Make. Ideas. Happen.”.
Update Php On Mac
I wish you flocking users, see you soon!