-
Notifications
You must be signed in to change notification settings - Fork 2
/
PHP-FPM-80.sh
98 lines (82 loc) · 2.23 KB
/
PHP-FPM-80.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
# Adding php pool conf
user="$1"
domain="$2"
ip="$3"
home_dir="$4"
docroot="$5"
pool_conf="[$2]
listen = /run/php/php8.0-fpm-$2.sock
listen.owner = $1
listen.group = $1
listen.mode = 0666
user = $1
group = $1
pm = ondemand
pm.max_children = 16
request_terminate_timeout = 30s
pm.max_requests = 4000
pm.process_idle_timeout = 10s
pm.status_path = /status
php_admin_value[upload_tmp_dir] = /home/$1/tmp
php_admin_value[session.save_path] = /home/$1/tmp
php_admin_value[open_basedir] = $5:/home/$1/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcube:/var/log/roundcube:/var/lib/roundcube
php_admin_value[upload_max_filesize] = 25M
php_admin_value[max_execution_time] = 120
php_admin_value[post_max_size] = 25M
php_admin_value[memory_limit] = 256M
php_admin_value[sendmail_path] = \"/usr/sbin/sendmail -t -i -f info@$2\"
php_admin_flag[mysql.allow_persistent] = off
php_admin_flag[safe_mode] = off
env[PATH] = /usr/local/bin:/usr/bin:/bin
env[TMP] = /home/$1/tmp
env[TMPDIR] = /home/$1/tmp
env[TEMP] = /home/$1/tmp
"
pool_file_56="/etc/php/5.6/fpm/pool.d/$2.conf"
pool_file_70="/etc/php/7.0/fpm/pool.d/$2.conf"
pool_file_71="/etc/php/7.1/fpm/pool.d/$2.conf"
pool_file_72="/etc/php/7.2/fpm/pool.d/$2.conf"
pool_file_73="/etc/php/7.3/fpm/pool.d/$2.conf"
pool_file_80="/etc/php/8.0/fpm/pool.d/$2.conf"
if [ -f "$pool_file_56" ]; then
rm $pool_file_56
service php5.6-fpm restart
fi
if [ -f "$pool_file_70" ]; then
rm $pool_file_70
service php7.0-fpm restart
fi
if [ -f "$pool_file_71" ]; then
rm $pool_file_71
service php7.1-fpm restart
fi
if [ -f "$pool_file_72" ]; then
rm $pool_file_72
service php7.2-fpm restart
fi
if [ -f "$pool_file_73" ]; then
rm $pool_file_73
service php7.3-fpm restart
fi
if [ -f "$pool_file_74" ]; then
rm $pool_file_74
service php7.4-fpm restart
fi
write_file=0
if [ ! -f "$pool_file_80" ]; then
write_file=1
else
user_count=$(grep -c "/home/$1/" $pool_file_80)
if [ $user_count -eq 0 ]; then
write_file=1
fi
fi
if [ $write_file -eq 1 ]; then
echo "$pool_conf" > $pool_file_80
service php8.0-fpm restart
fi
if [ -f "/etc/php/8.0/fpm/pool.d/www.conf" ]; then
rm /etc/php/8.0/fpm/pool.d/www.conf
fi
exit 0