-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup
executable file
·38 lines (33 loc) · 1.17 KB
/
setup
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
#!/bin/bash
php=$(php -v 2>/dev/null)
if [[ $php == *"PHP"* ]]; then
echo "PHP is already installed. Good!"
if [[ $php == *"PHP 5"* ]]; then
echo "Version 5 detected. Note that source is optimised for 7.2 or greater."
fi
if [[ $php == *"PHP 8"* ]]; then
echo "Version 8 detected. Note that source is not optimised for this major."
fi
exit 0
fi
echo "PHP needs to be installed. If you see any errors, you have to re-run the setup as super admin (sudo ./setup)."
apt=$(apt-cache show php 2>/dev/null)
if [[ $apt == *"Unable to locate package"* ]]; then
apt-get install php7.2 php7.2-mbstring php7.2-bcmath php7.2-xml php7.2-sqlite3 php7.2-mysql php7.2-json php7.2-curl php7.2-common phpunit composer
echo "PHP was installed by APT."
exit 0
fi
yum=$(yum 2>/dev/null)
if [[ $yum == *"usage: yum"* ]]; then
yum -y install php
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
echo "PHP was installed by Yum."
fi
pacman=$(pacman 2>/dev/null)
if [[ $pacman != *"not found"* ]]; then
pacman -S php
echo "PHP was installed by Pacman."
exit 0
fi