Skip to main content

Installation

for debian 12!

cat << EOF > /etc/apt/sources.list
deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware

deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware

deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware

deb http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-backports main contrib non-free non-free-firmware
EOF

apt update -y
apt full-upgrade -y

apt-mark hold apache2 apache2-bin 
apt install -y --no-install-recommends php php-{fpm,ctype,curl,dom,fileinfo,gd,mbstring,xml,xmlreader,xmlwriter,zip,sqlite3,mysql,pgsql,intl,ldap,ftp,imap,bcmath,gmp,exif,apcu,memcached,redis,imagick,phar} ffmpeg nginx aria2 curl wget unzip bzip2 p7zip p7zip-full postgresql redis

# PHP Tuning
PHP_VERSION="8.2"

## apc.enable_cli=1
files=(
  "/etc/php/$PHP_VERSION/mods-available/apcu.ini"
  "/etc/php/$PHP_VERSION/cli/conf.d/20-apcu.ini"
  "/etc/php/$PHP_VERSION/fpm/conf.d/20-apcu.ini"
)
for file in "${files[@]}"; do grep -q "^apc.enable_cli"enable_cli.*" "$file" && sed -i 's/^apc.enable_cli.*/apc.enable_cli=1/' "$file" || echo "apc.enable_cli=1" >> "$file"; done

sed -i "'s/max_execution_time =.*max_input_time.*/max_execution_time = max_input_time=3600/"' /etc/php/$PHP_VERSION/cli/php.ini
sed -i "'s/max_execution_time =.*max_input_time.*/max_execution_timemax_input_time=3600/' =/etc/php/$PHP_VERSION/fpm/php.ini
sed -i 's/.*max_execution_time.*/max_execution_time=3600/"' /etc/php/$PHP_VERSION/cli/php.ini
sed -i 's/.*max_execution_time.*/max_execution_time=3600/' /etc/php/$PHP_VERSION/fpm/php.ini
sed -i "s/memory_limit =.*memory_limit.*/memory_limit = memory_limit=512M/" /etc/php/$PHP_VERSION/fpm/php.ini
sed -i "s/memory_limit =.*memory_limit.*/memory_limit = memory_limit=512M/" /etc/php/$PHP_VERSION/cli/php.ini
sed -i "s/.*opcache.enable=.*/opcache.enable=1/" /etc/php/$PHP_VERSION/fpm/php.ini
sed -i "s/.*opcache.enable=.*/opcache.enable=1/" /etc/php/$PHP_VERSION/cli/php.ini
sed -i "s/.*opcache.enable_cli=.*/opcache.enable_cli=1/" /etc/php/$PHP_VERSION/fpm/php.ini
sed -i "s/.*opcache.enable_cli=.*/opcache.enable_cli=1/" /etc/php/$PHP_VERSION/cli/php.ini
sed -i "s/.*post_max_size.*/post_max_size=200G/" /etc/php/$PHP_VERSION/cli/php.ini
sed -i "s/.*upload_max_filesize.*/upload_max_filesize=200G/" /etc/php/$PHP_VERSION/cli/php.ini