Usando Pacotes

Existem algumas versões do PHP empacotadas e pré-compiladas para o macOS. Isso pode ajudar na instalação de uma configuração padrão, mas se você precisar ter algumas características diferentes (como um servidor seguro, ou um driver de banco de dados diferente), você pode precisar compilar o PHP e/ou seu servidor web por conta própria. Se você não estiver familiarizado com o procedimento de compilar seu próprio software, vale a pena checar se alguém já fez um pacote do PHP com as características que você precisa.

A maneira mais rápida de instalar o php no macOS é com homebrew:

  1. instale o homebrew, seguindo as instruções em » brew.sh

  2. brew install php

Os seguintes recursos alternativoes também oferecem pacotes fáceis de instalar e binários pré-compilados para usar o PHP no Mac OS:

add a note

User Contributed Notes 5 notes

up
9
marc_cole
1 year ago
Granted, this is not a "package", but I prefer to use phpbrew, as it allows me to install as many versions of PHP as I want for testing or whatever.

https://github.com/phpbrew/phpbrew
up
5
Chris Varen
5 months ago
@marc_cole Note that phpbrew (https://github.com/phpbrew/phpbrew) requires you already have some version of PHP on your system. This is because phpbrew itself is written in php. And recent versions of macOS no longer come with php included.

So phpbrew isn't really an alternative since you still need to use homebrew or something else to install php in the first place.
up
1
Sajt
1 year ago
You can use Laravel valet, what is included PHP, Nginx, DNSMasq and a lot of things for easy developing. (https://laravel.com/docs/8.x/valet)
up
0
saintalifrh at disroot dot org
1 year ago
Valet requires macOS and Homebrew. Before installation, you should make sure that no other programs such as Apache or Nginx are binding to your local machine's port 80.

you need to install brew anyway
up
-4
Anonymous
7 months ago
remember after step 1 installing homebrew to run these two commands, one at a time in the terminal window - where xxxxx is the name of the current profile - (who you are logged in as)

echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/xxxxx/.zprofile

eval "$(/opt/homebrew/bin/brew shellenv)"

Only then will you be able to run step 2 brew...
To Top