- .macos-big-sur % brew info php@7.4 php: stable 7.4.12 (bottled), HEAD General-purpose scripting language /usr/local/Cellar/php/7.
- Icons Pack in the style of macOS Big Sur. Join the community to add your comment. Please can you convert these to ICNS.
- I-ve been using big sur for a day now on a 2016 iMAc and a 2019 Macbook pro. Knowing that I have a extensive use of brew, I was surprised that I only had to manually install command line tools from here.Sure I get warnings, but overall.it just works.
Apple macOS 11.0 ships with both a relatively recent version of Apache (2.4.x), as well as PHP (7.3.x), so you’ll just have to install MySQL and go through a few steps to get everything up and running.
I upgraded from Mohave to Big Sur and found that homebrew is not working any more. I installed the command line tools using the command xcode-select -install After I run brew list, I get the foll.
Big Sur will likely be the last version of macOS that ships with PHP. Apple added the following deprecation warning: PHP is included in macOS for compatibility with legacy software. Future versions of macOS will not include PHP.
Apache
First, you have to create a web root in your user account:
Then add a configuration for your user:
Now we have to make sure that our user config above actually gets loaded:
If you want to use vhosts, you’ll also have to make sure that the vhosts config gets loaded:
After that, configure vhosts as necessary in /etc/apache2/extra/httpd-vhosts.conf
(don’t forget to remove the examples in there).
It seems that mod_rewrite no longer gets loaded by default, so we’ll also add that to our config:
PHP
PHP doesn’t get loaded by default. So we’ll also add it to our config:
You should also configure a few settings in /etc/php.ini
:
To activate these settings you have to restart Apache:
If you also need PEAR/PECL, follow these instructions.
MySQL
MySQL is not shipped with macOS, so we’ll have to install that manually. Instead of going for an installer package, we’ll use Homebrew. Once Homebrew is installed, installing MySQL is as simple as:
If you want to start MySQL automatically, run:
Any comments? Ping me on Twitter. 👉🏻 Get my newsletter for occasional updates. ✌🏻
Related Posts
Special Edition for those that have prior installations
Special Edition: macOS 11.0 Big Sur Development Environment
This is a guide to help those with prior Homebrew mutliple PHP-based installations that are looking to upgrade to the new Hombrew/core
PHP setup from the prior Homebrew/php
keg which is now deprecated.
With the deprecation of Homebrew/php
tap, many of the prior formulaes we used in this guide are no longer available. The cleanest way to migrate from the old brew formulae to the new pecl package approach is to remove everything PHP-related and reinstall with the new instructions.
The first step in this process is to update all the latest packages then upgrade them. This will actually 'migrate' the core PHP packages (which are the only ones supported), but there's a bunch of symlinks utilized that could cause problems down the road, so after upgrading, we'll remove all PHP packages, to provide a fresh start:
You can then double check the current installed PHP packages with:
Now we just need to remove everything:
Don't worry if you don't have all these packages installed, this is just a cumulative list and it will skip over anything that's not installed.
Now we can check to see if anything PHP-related is left:
Brew Apple M1
If you don't see anything you are all good. If something is still left, you can uninstall those individually using the same brew uninstall --force
syntax as above.
Now we want to clean out the old configuration options for PHP:
Now you've cleaned up your prior installation, you can jump to the PHP Installation section of Part 1 of the guide.