#! /bin/sh # setup-fcgid (Bourne shell script) -- for Debian/Ubuntu set -e source_dir=$(dirname "$0") install -d /usr/local/lib/fcgi-bin install --preserve-timestamps "$source_dir/php.fcgi" /usr/local/lib/fcgi-bin/ # Check Apache ver and if 2.2, don't install apache2-mpm-worker # ...but this is silly; libapache2-mod-php5 requires apache2-mpm-prefork # and conflicts with apache2-mpm-worker # Note: fcgid isn't used without apache2-mpm-worker ## ver=$(dpkg-query -W apache2 | sed 's/apache2[[:space:]]*\(.\..\).*/\1/') # Stop the next step from removing stuff dependent on php5-common apt-get install -y php5-common # Install worker package and other stuff; this removes libapache2-mod-php5 (only on Precise?) apt-get install -y php5-cgi libapache2-mod-fcgid apache2-mpm-worker apache2-suexec-custom # Avoid problems with /etc/apache2/mods-available/php5.conf being left behind # (only shows up when mod_userdir is installed, due to conditional use of "php_admin_value") apt-get purge -y libapache2-mod-php5 if [ -x /usr/sbin/a2enconf ] ; then install -m 644 --preserve-timestamps "$source_dir/local_fcgid.conf" /etc/apache2/conf-available/ a2enconf local_fcgid.conf else install -m 644 --preserve-timestamps "$source_dir/local_fcgid.conf" /etc/apache2/conf.d/ fi if [ -d /srv/web ] ; then if [ ! -f /etc/apache2/suexec/www-data.dist ] ; then cp -p /etc/apache2/suexec/www-data /etc/apache2/suexec/www-data.dist fi sed -i '1 s@^/var/www@/srv/web@' /etc/apache2/suexec/www-data fi ## a2dismod php5 ## a2dismod mpm_prefork ## a2enmod mpm_worker a2enmod suexec echo "Restarting Apache..." service apache2 restart echo "Done."