-
Notifications
You must be signed in to change notification settings - Fork 2
/
php-install.sh
55 lines (40 loc) · 2 KB
/
php-install.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
#!/bin/bash
# ARE YOU ROOT (or sudo)?
if [[ $EUID -ne 0 ]]; then
echo -e "\e[91mERROR: This script must be run as root\e[0m"
exit 1
fi
if [ -x "$(command -v yum)" ]; then
centos_version=$(rpm -qa \*-release | grep -Ei "oracle|redhat|centos" | sed 's/[^6-8]*//g' | cut -c1)
yum install php php-fpm php-mysqli php-gd php-xml php-mbstring php-soap php-bcmath -y
if [ "$centos_version" -le 7 ]; then
yum install php-mysql php-mcryp* -y
else
yum install php-json -y
fi
\cp php/php.ini /etc/
\cp php/www.conf /etc/php-fpm.d/
chown root:nginx /var/lib/php/session/
chmod 0777 /var/lib/php/session/
echo "extension='/usr/lib/php/modules/soap.so'" >> /etc/php.ini
service php-fpm start
chkconfig --levels 235 php-fpm on
./php-update.sh
elif [ -x "$(command -v apt-get)" ]; then
apt-get install php php-fpm php-mysql php-mysqli php-curl php-gd php-xml php-mbstring php-soap php-bcmath php-intl php-zip -y
php_version=$(php -v | head -1 | cut -d " " -f 2 | cut -d "." -f 1-2)
sed -i -e '/\(;\|\)\s*short_open_tag =/s/^.*$/short_open_tag = On/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*max_execution_time =/s/^.*$/max_execution_time = 60/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*max_input_time =/s/^.*$/max_input_time = 60/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*max_input_vars =/s/^.*$/max_input_vars = 5000/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*memory_limit =/s/^.*$/memory_limit = 128M/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*post_max_size =/s/^.*$/post_max_size = 100M/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*upload_max_filesize =/s/^.*$/upload_max_filesize = 100M/' /etc/php/$php_version/fpm/php.ini
sed -i -e '/\(;\|\)\s*date.timezone =/s/^.*$/date.timezone = "Europe\/Madrid"/' /etc/php/$php_version/fpm/php.ini
#\cp php/www.conf /etc/php/$php_version/fpm/pool.d/
service php$php_version-fpm restart
else
echo -e "\e[91mUnsupported system. Please install php manually.\e[0m"
exit 1
fi
php -v