macOS Ventura 13.0 Setup: Homebrew + Apache + PHP + MariaDB

This document helps keep your macOS development environment up and running with the latest Homebrew, Apache, PHP, and MariaDB.

Before we start, if you haven’t already installed XCode Command Line Tools on your system, let’s do that.

Homebrew Installation

Homebrew is an excellent package manager for macOS. Homebrew installs the stuff you need that Apple (or your Linux system) didn’t; let’s install it.

Homebrew can self-diagnose and check your system for potential problems. Let’s see if everything is working the way it should.

If the installation is successful, the output will be:

Your system is ready to brew.

Otherwise, please follow the instructions to fix any potential issues.

Apache Installation

macOS 13.0 Ventura comes with Apache 2.4 pre-installed. However, we don’t want Apple to control our web server so let’s stop it and prevent it from starting on boot.

Type the following command into your terminal to create a new folder in your user’s root directory.

💡 Tip: macOS automatically adds the compass icon to your folder.

Now, let’s brew and configure our new Apache version. We will update it to run on standard ports (80/443) shortly.

Check the installation path.

Set Apache to start now and restart at login.

💡 Tip: You can monitor the Apache error log in a new Terminal tab/window to see if anything is invalid or causing a problem.

💡 Tip: Remember useful Apache ‘brew services’ commands.

PHP Installation

Install the latest PHP version.

The php.ini file can be found in: .

Apache PHP Setup

Now that we have PHP successfully installed, we still need to tell Apache to use it. Please edit the Apache file.

Find Listen 8080 and change the port to 80:

Uncomment the following lines.

Add the following entry at the end of the LoadModules section.

Update User and Group where your_username is the name of your User in macOS and Group will be “staff.”

Servername is disabled by default; set it to localhost:

Let’s modify httpd.conf a bit more. Change DocumentRoot; it makes up the basic document tree, which will be visible from the web.

Check that directive DirectoryIndex includes .

And we need to add the directive so that Apache will now process PHP files.

Uncomment the following to enable user home directories, virtual hosts, and secure (SSL/TLS) connections.

Restart apache.

Run a configuration file syntax test to verify/validate the configuration. It reports “Syntax Ok” or detailed information about the particular syntax error. This is equivalent to .

If it says “Syntax OK,” open a browser using http://127.0.0.1. You should see a message saying, “It works!”

Then type in the terminal. It should report something like the following.

MariaDB Installation

Install MariaDB using Homebrew.

Let’s have MariaDB start automatically on boot.

You will see something like the following.

==> Successfully started `mariadb` (label: homebrew.mxcl.mariadb)

Improve the security of the installation and change the database’s root password.

You will be prompted with:

Enter current password for root (enter for none):

Press return here.

Change the root password, and continue with the prompts.

Change the root password? [Y/n]

When you get to the following prompt, enter Y to reload privileges.

Reload privilege tables now?

When finished, restart the MariaDB server.

You can now try logging into MariaDB.

If successful, you should see the following.

SSL/Virtual Hosts

The OpenSSL software library is a prerequisite to generate a certificate. Check if OpenSSL is available by running the following command in the local environment.

We need to install OpenSSL if the command does not return a path.

Change default 8443 ports to 443 in the SSL configuration file.

Replace all lines that say ‘8443’ with ‘443’.

After the file has been saved, follow the prompts to generate a key and a self-signed certificate.

Open up and add your own SSL-based virtual host entries.

Finally, in the Terminal window, restart Apache.

License

Copyright © 2022 Karl Hill.

Provided under the MIT license.

Whether you use these instructions or have learned something from them, please consider supporting me with a star ⭐ and a follow 🔥.

--

--

Full Stack Engineer at NASA. Volunteer at Smithsonian’s The Renwick Gallery, and former drummer of #GovernmentIssue. https://www.karlhill.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Karl Hill

Full Stack Engineer at NASA. Volunteer at Smithsonian’s The Renwick Gallery, and former drummer of #GovernmentIssue. https://www.karlhill.com