From a2a5e192db997694f5b6c22973aafbb1da20b24c Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Mon, 3 Jun 2024 10:21:04 -0700 Subject: [PATCH] autodect version of php, update version of phpMyAdmin --- install.sh | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/install.sh b/install.sh index d450d4b..39b7869 100755 --- a/install.sh +++ b/install.sh @@ -77,6 +77,11 @@ fi # Apache w/ PHP DEBIAN_FRONTEND=noninteractive apt-get -y install apache2 libapache2-mod-authnz-pam libwww-perl php-fpm php-cli php-bcmath php-ssh2 php-curl php-dev php-enchant php-mysql php-pear php-gd php-http php-imap php-intl php-mysql php-yaml php-pspell php-raphf php-ssh2 php-sqlite3 php-tidy php-xml php-xmlrpc php-zip php-mbstring php-imagick php-redis redis pwauth libapache2-mod-authnz-external +# set PHP version +PHP_MAJOR_VERSION=`php -r "echo PHP_MAJOR_VERSION;"` +PHP_MINOR_VERSION=`php -r "echo PHP_MINOR_VERSION;"` +phpVersion=$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION + ## http2 handled automatically now. ## http2 doesn't support logio, so look in to vhost log format fqdn=`hostname -f` @@ -89,7 +94,7 @@ sed -i "s|webmaster@localhost|webmaster@$fqdn|g" /etc/apache2/sites-available/*. cp etc/apache2/conf-available/* /etc/apache2/conf-available/ chmod 644 /etc/apache2/conf-available/*.conf chown root:root /etc/apache2/conf-available/*.conf -a2enconf php8.1-fpm phpMyAdmin +a2enconf php$phpVersion-fpm phpMyAdmin cp etc/apache2/mods-available/* /etc/apache2/mods-available/ chmod 644 /etc/apache2/mods-available/*.conf chown root:root /etc/apache2/mods-available/*.conf @@ -119,22 +124,22 @@ echo '' >> /etc/apache2/conf-available/security.conf systemctl enable --now vhost-reload-apache.path # configure php -sed -i "s|post_max_size = 8M|post_max_size = 256M|g" /etc/php/8.1/fpm/php.ini -sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 256M|g" /etc/php/8.1/fpm/php.ini -sed -i "s|;date.timezone =|date.timezone = 'America/Los_Angeles'|g" /etc/php/8.1/fpm/php.ini -sed -i "s|;date.timezone =|date.timezone = 'America/Los_Angeles'|g" /etc/php/8.1/cli/php.ini +sed -i "s|post_max_size = 8M|post_max_size = 256M|g" /etc/php/$phpVersion/fpm/php.ini +sed -i "s|upload_max_filesize = 2M|upload_max_filesize = 256M|g" /etc/php/$phpVersion/fpm/php.ini +sed -i "s|;date.timezone =|date.timezone = 'America/Los_Angeles'|g" /etc/php/$phpVersion/fpm/php.ini +sed -i "s|;date.timezone =|date.timezone = 'America/Los_Angeles'|g" /etc/php/$phpVersion/cli/php.ini # Change Debian/Ubuntu session settings back to php defaults for compatability with user jails & php chroots -sed -i "s|;session.save_path = \"/var/lib/php/sessions\"|session.save_path = \"/tmp\"|g" /etc/php/8.1/fpm/php.ini -sed -i "s|;session.save_path = \"/var/lib/php/sessions\"|session.save_path = \"/tmp\"|g" /etc/php/8.1/cli/php.ini -sed -i "s|session.gc_probability = 0|session.gc_probability = 1|g" /etc/php/8.1/fpm/php.ini -sed -i "s|session.gc_probability = 0|session.gc_probability = 1|g" /etc/php/8.1/cli/php.ini +sed -i "s|;session.save_path = \"/var/lib/php/sessions\"|session.save_path = \"/tmp\"|g" /etc/php/$phpVersion/fpm/php.ini +sed -i "s|;session.save_path = \"/var/lib/php/sessions\"|session.save_path = \"/tmp\"|g" /etc/php/$phpVersion/cli/php.ini +sed -i "s|session.gc_probability = 0|session.gc_probability = 1|g" /etc/php/$phpVersion/fpm/php.ini +sed -i "s|session.gc_probability = 0|session.gc_probability = 1|g" /etc/php/$phpVersion/cli/php.ini # Configure PHP-FPM to use "ondemand" -sed -i "s|pm = dynamic|pm = ondemand|g" /etc/php/8.1/fpm/pool.d/www.conf +sed -i "s|pm = dynamic|pm = ondemand|g" /etc/php/$phpVersion/fpm/pool.d/www.conf systemctl reload apache2 ## configure overrides # sed -i "s|^user = www-data|user = $USERNAME|g" /etc/php/7.2/fpm/pool.d/www.conf # sed -i "s|^group = www-data|group = $USERNAME|g" /etc/php/7.2/fpm/pool.d/www.conf -systemctl reload php8.1-fpm +systemctl reload php$phpVersion-fpm systemctl enable --now vhost-reload-php.path if [ -d /srv/www ]; then @@ -174,13 +179,13 @@ chown vhost:vhost /srv/www/html/status.php # phpMyAdmin DEBIAN_FRONTEND=noninteractive apt-get -y install php-bz2 php-tcpdf cd /usr/local/src -wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.tar.gz -tar zxf phpMyAdmin-5.2.0-all-languages.tar.gz -rm -r phpMyAdmin-5.2.0-all-languages/setup/ -if [ -d "phpMyAdmin-5.2.0-all-languages/test/" ]; then - rm -r phpMyAdmin-5.2.0-all-languages/test/ +wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz +tar zxf phpMyAdmin-5.2.1-all-languages.tar.gz +rm -r phpMyAdmin-5.2.1-all-languages/setup/ +if [ -d "phpMyAdmin-5.2.1-all-languages/test/" ]; then + rm -r phpMyAdmin-5.2.1-all-languages/test/ fi -mv phpMyAdmin-5.2.0-all-languages /srv/www/html/phpMyAdmin +mv phpMyAdmin-5.2.1-all-languages /srv/www/html/phpMyAdmin cd - cp html/phpMyAdmin/config.inc.php /srv/www/html/phpMyAdmin/config.inc.php blowfish_secret=`pwgen 32 -1`