Использование пакетов

Существуют несколько предварительно упакованных и предварительно скомпилированных версий PHP для macOS. Это может помочь в создании стандартных конфигураций, но если вам нужны специфические функции (например, безопасный сервер, или другой драйвер базы данных), вы можете установить PHP и/или веб-сервер самостоятельно. Если вы не знакомы с процессом сборки и компиляции программного обеспечения, стоит проверить, может кто-то уже собрал версию PHP с функциями, которые вам необходимы.

Самый быстрый способ установить PHP на macOS - с помощью homebrew:

  1. Установите homebrew, следуя инструкциям на » brew.sh

  2. brew install php

Следующие альтернативные ресурсы также предлагают простые в установке пакеты и предварительно скомпилированные двоичные файлы для PHP в Mac OS:

add a note

User Contributed Notes 6 notes

up
11
Chris Varen
7 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
7
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
3
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
-1
riordan at rocketmail dot com
11 days ago
Note that with recent versions of macos, you'll have to code-sign the PHP module installed by

brew install php

before Apache will load and run it.

Instructions for this can be found at https://blog.phusion.nl/2020/12/22/future_of_macos_apache_modules/
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
-8
Anonymous
9 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