-
Notifications
You must be signed in to change notification settings - Fork 0
/
provision.sh
96 lines (82 loc) · 2.5 KB
/
provision.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
#!/usr/bin/env bash
# Environment Laravel original provisioning script
# https://github.com/dung13890
# Update Package List
apt-get update
apt-get install -y software-properties-common locales
locale-gen en_US.UTF-8
echo "LANGUAGE=en_US.UTF-8" >> /etc/default/locale
echo "LC_ALL=en_US.UTF-8" >> /etc/default/locale
echo "LC_CTYPE=UTF-8" >> /etc/default/locale
export LANG=en_US.UTF-8
# PPA
apt-add-repository ppa:ondrej/php -y
# Install PHP-CLI 7, some PHP extentions
apt-get update
apt-get install -y --force-yes \
php7.3-cli \
php7.3-common \
php7.3-curl \
php7.3-json \
php7.3-soap \
php7.3-xml \
php7.3-mbstring \
php7.3-mysql \
php7.3-pgsql \
php7.3-sqlite \
php7.3-sqlite3 \
php7.3-zip \
php7.3-gd \
php7.3-xdebug \
php7.3-bcmath \
php7.3-intl \
php7.3-dev \
php7.3-fpm \
php-pear \
php-memcached \
php-redis \
php-apcu \
libcurl4-openssl-dev \
libedit-dev \
libssl-dev \
libxml2-dev \
xz-utils \
sqlite3 \
libsqlite3-dev \
libmcrypt-dev \
libreadline-dev \
autoconf \
zlib1g-dev \
git \
curl \
vim \
zip \
unzip \
supervisor
# Installing mcrypt on PHP 7.3
printf "\n" | pecl channel-update pecl.php.net
printf "\n" | pecl -d php_suffix=7.3 install mcrypt-1.0.2
printf "\n" | pecl -d php_suffix=7.3 install grpc
printf "\n" | pecl -d php_suffix=7.3 install protobuf
bash -c "echo extension=mcrypt.so >> /etc/php/7.3/mods-available/mcrypt.ini"
bash -c "echo extension=grpc.so >> /etc/php/7.3/cli/php.ini"
bash -c "echo extension=protobuf.so >> /etc/php/7.3/cli/php.ini"
# Remove load xdebug extension
sed -i 's/^/;/g' /etc/php/7.3/cli/conf.d/20-xdebug.ini
# Set php7.3-fpm
sed -i "s/listen =.*/listen = 0.0.0.0:9000/" /etc/php/7.3/fpm/pool.d/www.conf
sed -i "s/display_errors = .*/display_errors = On/" /etc/php/7.3/fpm/php.ini
sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/7.3/fpm/php.ini
sed -i "s/post_max_size = .*/post_max_size = 50M/" /etc/php/7.3/fpm/php.ini
sed -i "s/upload_max_filesize = .*/upload_max_filesize = 50M/" /etc/php/7.3/fpm/php.ini
mkdir -p /var/run/php
mkdir -p /var/log/php-fpm
touch /var/run/php/php7.3-fpm.sock
# Install Composer, PHPCS
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
composer global require "squizlabs/php_codesniffer=*"
# Create symlink
ln -s /root/.composer/vendor/bin/phpcs /usr/bin/phpcs
# Clean up
apt-get clean && apt-get autoclean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*