Skip to content

Instantly share code, notes, and snippets.

@giladdarshan
giladdarshan / macos_php_build.md
Last active September 13, 2024 11:12
Steps to build / compile PHP from source on macOS

The following steps will describe how to build PHP from source including PHP's Apache module as it is no longer part of macOS starting with macOS Monterey.
If this is for a development environment, you can simply install PHP with Homebrew using the command brew install php. This guide is for cases where you need a more portable PHP without heavily dependening on external libraries.

  1. Install Homebrew
  2. Install the following Homebrew packages
    • libxml2
    • libiconv
    • apr
    • apr-util
  3. Build Apache, if PHP's Apache module is not required, skip to step 4.