Created
October 4, 2010 07:43
-
-
Save bpizzi/609353 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Root! | |
if [ $(id -u) != "0" ]; then | |
echo "Erreur: vous devez être root, lancez sudo sh $0" | |
exit 1 | |
fi | |
#Installation php fpm 5.3 | |
SLFILE="/etc/apt/sources.list" | |
DEPOT="deb http://packages.dotdeb.org stable all" | |
grep -q "$DEPOT" $SLFILE || echo $DEPOT >> $SLFILE | |
DEPOT="deb-src http://packages.dotdeb.org stable all" | |
grep -q "$DEPOT" $SLFILE || echo $DEPOT >> $SLFILE | |
DEPOT="deb http://php53.dotdeb.org stable all" | |
grep -q "$DEPOT" $SLFILE || echo $DEPOT >> $SLFILE | |
DEPOT="deb-src http://php53.dotdeb.org stable all" | |
grep -q "$DEPOT" $SLFILE || echo $DEPOT >> $SLFILE | |
gpg --keyserver keys.gnupg.net --recv-key 89DF5277 | |
gpg -a --export 89DF5277 | apt-key add - | |
apt-get update | |
apt-get install php5 php5-dev php5-cli php5-mysql php5-apc php5-mcrypt php5-curl php-pear php5-fpm | |
apt-get remove apache2-mpm-prefork | |
#Sauvegarde des fichiers de config initiaux | |
if [ ! -b /etc/php5/fpm/php5-fpm.conf.original ] | |
then | |
cp /etc/php5/fpm/php5-fpm.conf /etc/php5/fpm/php5-fpm.conf.original | |
fi | |
if [ ! -b /etc/php5/fpm/php.ini.original ] | |
then | |
cp /etc/php5/fpm/php.ini /etc/php5/fpm/php.ini.original | |
fi | |
if [ ! -b /etc/php5/cli/php.ini.original ] | |
then | |
cp /etc/php5/cli/php.ini /etc/php5/cli/php.ini.original | |
fi | |
#Configuration | |
CONF="/etc/php5/fpm/php5-fpm.conf" | |
touch $CONF | |
#On d�commente les directives | |
sed -i 's#;pid = #pid = #' $CONF | |
sed -i 's#;error_log = /var/log/php5-fpm.log#error_log = /var/log/php5-fpm.log#' $CONF | |
sed -i 's#;pm = #pm = #' $CONF | |
sed -i 's#;pm.max_children#pm.max_children#' $CONF | |
sed -i 's#;pm.start_servers#pm.start_servers#' $CONF | |
sed -i 's#;pm.min_spare_servers#pm.min_spare_servers#' $CONF | |
sed -i 's#;pm.max_spare_servers#pm.max_spare_servers#' $CONF | |
sed -i 's#;pm.max_requests#pm.max_requests#' $CONF | |
sed -i 's#;pm.status_path#pm.status_path#' $CONF | |
#Puis on les parametre selon nos souhaits | |
# 20/5/10 est adapte a une box de 256mo | |
MAXCHILDREN="20" | |
sed -i 's#pm.max_children = .*#pm.max_children = '$MAXCHILDREN'#' $CONF | |
STARTSERVERS="5" | |
sed -i 's#pm.start_servers = .*#pm.start_servers = '$STARTSERVERS'#' $CONF | |
MAXSPARE="10" | |
sed -i 's#pm.max_spare_servers = .*#pm.max_spare_servers = '$MAXSPARE'#' $CONF | |
STATUSPATH="/fpm-status" | |
sed -i 's#pm.status_path = .*#pm.status_path = '$STATUSPATH'#' $CONF | |
#Pas besoin de passer par la pile TCPIP : le socket prend moins de ressources | |
sed -i 's/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/' $CONF | |
#On defini date.timezone | |
CONF="/etc/php5/fpm/php.ini" | |
sed -i 's#;date.timezone =#date.timezone = "Europe/Paris"#' $CONF | |
CONF="/etc/php5/cli/php.ini" | |
sed -i 's#;date.timezone =#date.timezone = "Europe/Paris"#' $CONF | |
/etc/init.d/php5-fpm start | |
#On demarre php a chaque boot | |
update-rc.d php-fpm defaults | |
apt-get autoremove |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment