install.inc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. hestia_module_php_install() {
  3. source $HESTIA/bin/module/func.inc
  4. source $HESTIA/bin/module/php/func.inc
  5. if hestia_module_isinstalled 'php' && [ ! "$param_force" ]; then
  6. echo "PHP module is already installed. See 'hestia module info php'."
  7. return 0
  8. fi
  9. echo "Installing PHP module..."
  10. if [ "$OS_BASE" = 'debian' ]; then
  11. cat > /etc/apt/sources.list.d/php.list <<EOL
  12. # This file was added by Hestia Control Panel.
  13. deb https://packages.sury.org/php/ $OS_CODENAME main
  14. EOL
  15. apt-key adv --fetch-keys 'https://packages.sury.org/php/apt.gpg' > /dev/null 2>&1
  16. elif [ "$OS_BASE" = 'ubuntu' ]; then
  17. LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php > /dev/null 2>&1
  18. elif [ "$OS_BASE" = 'rhel' ]; then
  19. # Disable CentOS PHP, enable Remi PHP
  20. dnf -yq module disable php
  21. dnf -yq install http://rpms.remirepo.net/enterprise/remi-release-$OS_VERSION.rpm
  22. dnf config-manager --set-enabled remi remi-modular
  23. dnf -yq module reset php
  24. dnf -yq module enable php:remi-$PHP_DEFAULT_VERSION
  25. fi
  26. # Install mod_php for system default PHP
  27. osal_package_preinstall
  28. osal_execute_with_spinner osal_package_install $PHP_PKG_MOD_PHP
  29. mkdir -p $OSAL_PATH_RUN/php
  30. osal_kv_write $HESTIA_CONF_MODULES/php.conf 'installed' 1
  31. # Add default PHP version
  32. echo "Adding default PHP (CLI) version..."
  33. hestia module php add default
  34. return 0
  35. }