pastafari2/scripts/system/install_php.py
2023-03-28 18:20:35 +02:00

29 lines
1 KiB
Python

#!/usr/bin/python3 -u
# A script for install pzoo user
from subprocess import call
from time import sleep
import distro
linux_distro=distro.id()
print('{"error": 0, "status": 0, "progress": 0, "no_progress":0, "message": "Installing php..."}')
sleep(1)
if linux_distro=='arch':
if call("sudo pacman -S --noconfirm php php-gd php-pgsql php-snmp php-sodium php-sqlite", shell=True) > 0:
print('Error, cannot install php...')
exit(1)
elif linux_distro=='debian' or linux_distro=='ubuntu':
if call('sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y php-fpm php-gd php-json php-mysql php-curl php-mbstring php-intl php-imagick php-xml php-zip php-redis unzip', shell=True) > 0:
print('Error, cannot install php...')
exit(1)
elif linux_distro=='rocky' or linux_distro=='fedora':
if call("sudo dnf install -y php php-gd php-mysqlnd php-fpm php-zip", shell=True) > 0:
print('Error, cannot install php...')
exit(1)