#!/bin/sh
set -e

chown -R www-data.www-data /var/lib/php
chmod -R ug=rwX,o=rX /var/lib/php

if [ -x /usr/sbin/apacheconfig ]
then
    if ! grep /usr/lib/apache/modules/mod_php.so \
	/etc/apache/httpd.conf > /dev/null 2>&1
    then
	echo -n "The PHP/FI module is installed.  Reconfigure Apache now? [y/N] "
	read REPLY
	if [ "$REPLY" = "y" -o "$REPLY" = "Y" ]
	then
	    exec /usr/sbin/apacheconfig --force-modules --update
	fi
    fi
fi
