Caddy, PHP8, MariaDB on Mac using homebrew

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Code language: JavaScript (javascript)

Install Caddy, PHP, MariaDB

brew install caddy php mariadb

Setting up

Caddy

We’re gonna edit Caddyfile configuration located in /usr/local/etc/Caddyfile.

localhost {

encode gzip zstd
file_server
root * /somewhere/to/serve
php_fastcgi unix//usr/local/var/run/php.sock

}Code language: JavaScript (javascript)

Start caddy service.

brew services start caddy

PHP-FPM

Find this phrase in PHP8-FPM conf, located /usr/local/etc/php/8.0/php-fpm.d/www.conf

listen = 127.0.0.1:9000

revise it to:

listen = /usr/local/var/run/php.sockCode language: JavaScript (javascript)

And edit php.ini as follows, located in /usr/local/etc/php/8.0/php.ini

upload_max_filesize = 100M
allow_url_fopen = Off
post_max_size = 100M

And add more configs for opcache, located in /usr/local/etc/php/8.0/conf.d/ext-opcache.ini

opcache.jit=1255
opcache.jit_buffer_size=100M

Now start php service.

brew services start php

mariadb

brew services start mariadb
sudo mariadb-secure-installation
  1. n
  2. y -> enter new root password
  3. y
  4. y
  5. y
  6. y

Now, Enjoy!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *