Stackscript not working properly - copy and paste code is ok
I have a stackscript I am working on, and if I copy and paste the lines one by one it works flawlessly but if I run it as a script the patching of php with php-fpm (see below) doesn't seem to work - no errors, it looks like it is fine (as in the output says patched okay) but when it tries to configure php it says unknown option –with-fpm.
i'm stumped - surely if it works copying and pasting line by line it must work as a script?
Script is below:
#!/bin/bash
apt-get update
apt-get -y install locales
dpkg-reconfigure locales
apt-get -y upgrade
echo "console-setup console-setup/charmap select UTF-8" | debconf-set-selections
# General requirements etc
apt-get -y install wget build-essential libpcre3 libpcre3-dev libssl-dev libtool libltdl3-dev libgd2-xpm-dev libmcrypt-dev libxml2-dev libmysqlclient15-dev flex m4 gawk automake autoconf bison make libbz2-dev libpcre3-dev libssl-dev zlib1g-dev re2c libssl-dev libcurl3 libcurl4-openssl-dev unzip
# Build nginx from source
cd /usr/src
wget http://nginx.org/download/nginx-0.7.65.tar.gz
tar -zxf nginx-0.7.65.tar.gz
cd nginx-0.7.65
./configure --sbin-path=/usr/local/sbin --conf-path=/etc/nginx/nginx.conf --user=www-data --group=www-data --with-http_ssl_module --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-client-body-temp-path=/var/tmp/nginx/client
make && make install
mkdir /var/www
mkdir /var/tmp/nginx
mv /usr/local/nginx/html/* /var/www/
wget http://notomato.net/downloads/nginx.init.d.txt
mv nginx.init.d.txt /etc/init.d/nginx
chmod +x /etc/init.d/nginx
mkdir /etc/nginx/sites-available
mkdir /etc/nginx/sites-enabled
wget http://notomato.net/downloads/nginx.conf.txt
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old
mv nginx.conf.txt /etc/nginx/nginx.conf
wget http://notomato.net/downloads/nginx.default.txt
mv nginx.default.txt /etc/nginx/sites-available/default
ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default
/usr/sbin/update-rc.d -f nginx defaults
cd /usr/src
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xvzf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure
make && make install
echo "/usr/local/lib" > /etc/ld.so.conf.d/libevent.conf
ldconfig
cd ..
wget http://launchpad.net/php-fpm/master/0.6/+download/php-fpm-0.6~5.2.patch
wget http://be2.php.net/get/php-5.2.12.tar.gz/from/uk.php.net/mirror
tar -xvzf php-5.2.12.tar.gz
cat php-fpm-0.6~5.2.patch | patch -d php-5.2.12 -p1
wget http://download.suhosin.org/suhosin-patch-5.2.12-0.9.7.patch.gz
gunzip suhosin-patch-5.2.12-0.9.7.patch.gz
cat suhosin-patch-5.2.12-0.9.7.patch | patch -d php-5.2.12 -p1
cd php-5.2.12
./buildconf --force
./configure --enable-fastcgi --with-fpm --with-libevent=shared,/usr/local/lib --with-mcrypt --with-zlib --enable-mbstring --with-openssl --with-mysql --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --with-config-file-path=/etc/php --with-curl --with-fpm-user=www-data --with-fpm-group=www-data
make all install
update-rc.d -f php-fpm defaults
mkdir /etc/php
cp php.ini-recommended /etc/php/php.ini
cd ..
3 Replies
cd /usr/src/php-5.2.12
read -sn 1 -p "Press any key to continue..."
./buildconf --force
it seems to work fine.
However, I still have the problem it prompting me to save a PHP script.
Will make it public when I am done, should be under stackscripts for ubuntu.