This repository was archived by the owner on May 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.sh
More file actions
executable file
·80 lines (66 loc) · 2.78 KB
/
server.sh
File metadata and controls
executable file
·80 lines (66 loc) · 2.78 KB
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
#!/bin/bash
. ~/.bash_profile
test -f $HOME/.setup && . $_
alias make_httpd=". $install/bin/make-httpd.sh"
# Keep-alive: Might as well ask for password up-front, right?
sudo -v; while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# ******************************************************************************
# SERVER INSTALL SCRIPT
# Based on https://getgrav.org/blog/macos-catalina-apache-multiple-php-versions
# ******************************************************************************
# NOTE: Homebrew automatically installs XCode, without any prompts. Git requires this.
if [[ ! $(which brew) ]]; then
alert "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew cleanup
brew doctor
fi
alert "Installing Local Server"
sudo apachectl stop
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
sudo killall httpd
brew install openldap
brew install libiconv
brew install httpd
brew install mariadb
brew install dnsmasq
alert "Installing PHP"
ver="7.4"
brew install php@$ver
brew link php@$ver # required for pecl
filename="/usr/local/etc/php/$ver/php.ini"
contents=$(cat $filename)
contents=$(replace "$contents" "memory_limit" "500")
contents=$(replace "$contents" "max_execution_time" "120")
echo "$contents" >| $filename
pecl uninstall -r apcu && pecl install apcu <<<''
pecl uninstall -r yaml && pecl install yaml <<<''
pecl uninstall -r xdebug && pecl install xdebug
brew install pkg-config imagemagick
pecl install imagick <<<''
alert "Configure Server"
make_httpd apache
make_httpd php
make_httpd vhosts
make_httpd extra
ln -sf $apache/httpd-vhosts.conf /usr/local/etc/httpd/extra/httpd-vhosts.conf
alert "Installing PHP Switcher Script..."
curl -L https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw >| /usr/local/bin/sphp
chmod +x /usr/local/bin/sphp
sphp "$ver"
echo 'address=/.test/127.0.0.1' >| /usr/local/etc/dnsmasq.conf
sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/test'
alert "Configuring vHosts for Crema..."
echo -e "Define ENV $ENV\nDefine CACHING false\nDefine CLIENTS \"$sites\"" >| "$apache/.env.conf"
curl -L https://git.io/JtqkV -o $apache/.env.conf
echo -e 'ENV="work"\nvhost="$apache/vhosts/$ENV.conf"\nalias vhost="open $apache/vhosts/${ENV}.conf"' >| ~/.profile
alert "Booting up Server"
brew services start httpd
brew services start mariadb
sudo brew services start dnsmasq
alert "Creating an Awesome Test Project"
makesite demo.test $sites/demo twig
alert "Important Notes and Issues:"
echo "- You might need to adjust the .env file in the apache folder"
echo "- If you have issues, double-check your work/home.conf apache config"