Skip to content

Instantly share code, notes, and snippets.

@giladdarshan
giladdarshan / macos_php_build.md
Last active April 16, 2024 05:34
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.