Skip to content

Instantly share code, notes, and snippets.

@dgalli1
Last active May 5, 2026 08:06
Show Gist options
  • Select an option

  • Save dgalli1/b4552c28d5a9186cec342f8c0a4aef3b to your computer and use it in GitHub Desktop.

Select an option

Save dgalli1/b4552c28d5a9186cec342f8c0a4aef3b to your computer and use it in GitHub Desktop.
Install PHP With all extensions on arch
PHPVER=85
sudo pacman -S $(pacman -Ss "^php${PHPVER}-" | awk '/^repo\// {print $1}' | sed 's/^repo\///')
sudo install -d /etc/systemd/system/php${PHPVER}-fpm.service.d
sudo tee /etc/systemd/system/php${PHPVER}-fpm.service.d/override.conf > /dev/null <<EOF
[Service]
User=${USER}
Group=${USER}
PermissionsStartOnly=true
ExecStartPre=/usr/bin/mkdir -p /run/php${PHPVER}-fpm
ExecStartPre=/usr/bin/chown -R ${USER}:${USER} /run/php${PHPVER}-fpm
ExecStartPre=/usr/bin/chmod 755 /run/php${PHPVER}-fpm
EOF
sudo sed -i \
-e "s/^user = .*/user = ${USER}/" \
-e "s/^group = .*/group = ${USER}/" \
/etc/php85/php-fpm.d/www.conf
systemctl enable --now php${PHPVER}-fpm
CONF=/etc/php${PHPVER}/php-fpm.d/www.conf
sudo sed -i \
-e 's/^\s*user\s*=\s*http\s*$/; user = http/' \
-e 's/^\s*group\s*=\s*http\s*$/; group = http/' \
"$CONF"
grep -q "listen.owner = damian" "$CONF" || sudo tee -a "$CONF" > /dev/null <<EOF
listen.owner = damian
listen.group = damian
listen.mode = 0777
EOF
sudo sed -i \
-E 's/^\s*;?\s*memory_limit\s*=.*/memory_limit = 1024M/' \
/etc/php${PHPVER}/php.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment