conf_server/install_php.sh

60 lines
1022 B
Bash
Executable File

#!/bin/sh
install_php_package()
{
pkg_add php-8.0.26
}
gen_php_configuration(){
cat > my_configuration/php/php-fpm.conf <<EOF
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
[global]
error_log = log/php-fpm.log
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
include=/etc/php-fpm.d/*.conf
[www]
user = www
group = www
listen = /var/www/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chroot = /var/www
env[HOSTNAME] = \$HOSTNAME
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
EOF
}
install_configurations_files()
{
cp -v /etc/php-fpm.conf /etc/php-fpm.conf.old
cp -v my_configuration/php/php-fpm.conf /etc/php-fpm.conf
}
start_php_service()
{
rcctl start php80_fpm
}
mkdir my_configuration/php/
install_php_package
gen_php_configuration
install_configurations_files
start_php_service