There are several steps for the installation of PHP in Windows MacOS and Linux. In this article we cover the most common installation procedure for each operating system. As a result, you can install and configure other tools and frameworks like Laravel.
Using the default packages of Debian/Ubuntu repository.
sudo apt-get update
sudo apt-get install php
The default MacOS installation comes with PHP installed (Php 7.1 in High Sierra). However, it’s recommended to install and update Php 7 using HomeBrew, to get more extensions available without installing additional components:
brew install firstname.lastname@example.org
Or update if you have a previous version
brew upgrade email@example.com
Also, you need to replace symlinks to HomeBrew links:
brew link --overwrite --force firstname.lastname@example.org
As a result, you will be prompted to modify your ~/.bash_profile startup script. Run the commands in a console:
echo 'export PATH="/email@example.com/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/firstname.lastname@example.org/sbin:$PATH"' >> ~/.bash_profile
This new installation brings a bigger set of extensions already loaded (like php-intl). Now, your php.ini file will be located in
The most simple way to get a local PHP installation along with Apache HTTP server integration is using the XAMPP package installation. However, Setting up and configuring Nginx on Windows requires a bit more configuration. See the Nginx documentation for additional setup help.