-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
54 lines (40 loc) · 1.47 KB
/
install.sh
File metadata and controls
54 lines (40 loc) · 1.47 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
#!/bin/bash
# check if PHP is installed
php -v >> /dev/null
if [ $? -ne 0 ]; then echo "PHP is not installed"; exit 1; fi
echo "php is working"
apache2 -v >> /dev/null
if [ $? -ne 0 ]; then echo "PHP is not installed"; exit 1; fi
echo "apache is working"
# install zmq
sudo apt-get install php5-dev pkg-config libzmq-dev -y
git clone git://github.com/mkoppanen/php-zmq.git
pushd php-zmq
phpize && ./configure
sudo make
sudo make install
popd
# modify php.ini
files=( $(sudo find / -name "php.ini") )
for file in "${files[@]}"; do
grep "extension=zmq.so" $file >> /dev/null
if [ $? -ne 0 ]; then
echo "extension=zmq.so" | sudo tee -a $file
if [ $? -ne 0 ]; then
echo "error adding extension to $file, skipping file"
fi
fi
done
if [ ! -e "composer.phar" ]; then
# May break, depends on current version of Composer
php -r "readfile('https://getcomposer.org/installer');" > composer-setup.php
php -r "if (hash('SHA384', file_get_contents('composer-setup.php')) === '7228c001f88bee97506740ef0888240bd8a760b046ee16db8f4095c0d8d525f2367663f22a46b48d072c816e7fe19959') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
fi
if [ ! -e "composer.phar" ]; then echo "Composer install failed"; exit 1; fi
# change permissions for composer (just in case)
sudo chmod +x composer.phar
# run composer install
php composer.phar install
sudo service apache2 restart