Installation of PHP in Windows, MacOS and Linux

Francisco Igor
Oct 20, 2018

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.

Linux Installation

Debian/Ubuntu

Using the default packages of Debian/Ubuntu repository.

sudo apt-get update
sudo apt-get install php

MacOS Installation

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 php@7.1

Or update if you have a previous version

brew upgrade php@7.1

Also, you need to replace symlinks to HomeBrew links:

brew link --overwrite --force php@7.1

As a result, you will be prompted to modify your ~/.bash_profile startup script. Run the commands in a console:

echo 'export PATH="/usr/local/opt/php@7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php@7.1/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 /usr/local/etc/php/7.1/php.ini

Windows Installation

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.

See Also

Configure PHP and Laravel Framework

How to change the Laravel public folder path

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Francisco Igor
Francisco Igor

Written by Francisco Igor

Programming from the past century. Worked with many programming languages and software development tools for desktop, web and mobile. https://fraigo.github.io/

No responses yet

Write a response