autodect version of php, update version of phpMyAdmin

This commit is contained in:
Matthew Saunders Brown 2024-06-03 10:21:04 -07:00
parent f20bd3b14e
commit a2a5e192db

View File

@ -77,6 +77,11 @@ fi
# Apache w/ PHP # 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 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 handled automatically now.
## http2 doesn't support logio, so look in to vhost log format ## http2 doesn't support logio, so look in to vhost log format
fqdn=`hostname -f` 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/ cp etc/apache2/conf-available/* /etc/apache2/conf-available/
chmod 644 /etc/apache2/conf-available/*.conf chmod 644 /etc/apache2/conf-available/*.conf
chown root:root /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/ cp etc/apache2/mods-available/* /etc/apache2/mods-available/
chmod 644 /etc/apache2/mods-available/*.conf chmod 644 /etc/apache2/mods-available/*.conf
chown root:root /etc/apache2/mods-available/*.conf chown root:root /etc/apache2/mods-available/*.conf
@ -119,22 +124,22 @@ echo '</Directory>' >> /etc/apache2/conf-available/security.conf
systemctl enable --now vhost-reload-apache.path systemctl enable --now vhost-reload-apache.path
# configure php # configure php
sed -i "s|post_max_size = 8M|post_max_size = 256M|g" /etc/php/8.1/fpm/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/8.1/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/8.1/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/8.1/cli/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 # 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/$phpVersion/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.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/8.1/fpm/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/8.1/cli/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" # 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 systemctl reload apache2
## configure overrides ## configure overrides
# sed -i "s|^user = www-data|user = $USERNAME|g" /etc/php/7.2/fpm/pool.d/www.conf # 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 # 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 systemctl enable --now vhost-reload-php.path
if [ -d /srv/www ]; then if [ -d /srv/www ]; then
@ -174,13 +179,13 @@ chown vhost:vhost /srv/www/html/status.php
# phpMyAdmin # phpMyAdmin
DEBIAN_FRONTEND=noninteractive apt-get -y install php-bz2 php-tcpdf DEBIAN_FRONTEND=noninteractive apt-get -y install php-bz2 php-tcpdf
cd /usr/local/src cd /usr/local/src
wget https://files.phpmyadmin.net/phpMyAdmin/5.2.0/phpMyAdmin-5.2.0-all-languages.tar.gz wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz
tar zxf phpMyAdmin-5.2.0-all-languages.tar.gz tar zxf phpMyAdmin-5.2.1-all-languages.tar.gz
rm -r phpMyAdmin-5.2.0-all-languages/setup/ rm -r phpMyAdmin-5.2.1-all-languages/setup/
if [ -d "phpMyAdmin-5.2.0-all-languages/test/" ]; then if [ -d "phpMyAdmin-5.2.1-all-languages/test/" ]; then
rm -r phpMyAdmin-5.2.0-all-languages/test/ rm -r phpMyAdmin-5.2.1-all-languages/test/
fi fi
mv phpMyAdmin-5.2.0-all-languages /srv/www/html/phpMyAdmin mv phpMyAdmin-5.2.1-all-languages /srv/www/html/phpMyAdmin
cd - cd -
cp html/phpMyAdmin/config.inc.php /srv/www/html/phpMyAdmin/config.inc.php cp html/phpMyAdmin/config.inc.php /srv/www/html/phpMyAdmin/config.inc.php
blowfish_secret=`pwgen 32 -1` blowfish_secret=`pwgen 32 -1`