Skip to content

Instantly share code, notes, and snippets.

I recently got a new Macbook Pro and wanted to document how I setup my PHP environment. I like full control of how PHP is built and I usually build it from source. I do this because I often add custom extensions and modules not found in the common PHP OSX installers. If your looking for a easier method than building from source try https://php-osx.liip.ch/.

NOTE: This post assumes you are running a fresh install of MacOS Sierra 10.12.16 with System Integrity Protection disabled. If you don't know how to disable it just boot into recovery mode and open a terminal and type csrutil disable, or google search it :) This post also assumes you are using Zsh instead of Bash shell. If you are using Bash you can replace anytime you see ~/.zshrc with ~/.bashrc.

First lets get some of the prerequisites. Start by grabbing the command line tools neccessary:

xcode-select --install
@ClosetGeek-Git
ClosetGeek-Git / macos_php_build.md
Created December 29, 2024 04:52 — forked from giladdarshan/macos_php_build.md
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.
@ClosetGeek-Git
ClosetGeek-Git / install_lamp_ubuntu.sh
Created December 23, 2024 19:02 — forked from ankurk91/install_lamp_ubuntu.sh
Ubuntu 22/24 - PHP development (php 7.4 / 8.4, apache 2.4)
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Ubuntu Server
# Run like (without sudo) - bash install_lamp.sh
# Script should auto terminate on errors
export DEBIAN_FRONTEND=noninteractive
@ClosetGeek-Git
ClosetGeek-Git / DrawSineWave.html
Created August 27, 2024 23:59 — forked from gkhays/DrawSineWave.html
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
@ClosetGeek-Git
ClosetGeek-Git / DrawSineWave.html
Created August 27, 2024 23:59 — forked from gkhays/DrawSineWave.html
Oscillating sine wave, including the steps to figuring out how to plot a sine wave
<!DOCTYPE html>
<html>
<head>
<title>Sine Wave</title>
<script type="text/javascript">
function showAxes(ctx,axes) {
var width = ctx.canvas.width;
var height = ctx.canvas.height;
var xMin = 0;
@ClosetGeek-Git
ClosetGeek-Git / td3_arp_raw.py
Created May 6, 2024 18:48 — forked from PeteMidi/td3_arp_raw.py
TD-3 arpeggiator in Python 3 using numpy and Mido
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on July 7 2020
@author: Pete Midi
"""
import mido
import numpy as np
@ClosetGeek-Git
ClosetGeek-Git / zmqpoll.cc
Created July 19, 2023 16:25
Swoole reactor implementation using zmq_poll from libzmq for handling native ZMQSockets objects created via php-zmq along with Swoole network::Socket
#include "zmq.h"
#include "swoole.h"
#include "php_swoole_cxx.h"
#include "swoole_socket.h"
#include "swoole_reactor.h"
namespace swoole {
using network::Socket;
@ClosetGeek-Git
ClosetGeek-Git / fcgi_responder.php
Last active December 12, 2022 18:49
FastCGI Server / Responder over Swoole Unix domain socket
<?php
// based on Stone FastCGI https://github.com/StoneGroup/stone copyright MIT according to it's composer.json
class FastCGIConnection
{
private $server;
private $from_id;
private $fd;