-if [ -f /etc/php.ini ]; then
- cp /etc/php.ini /etc/php.ini.old
-fi
-cp ../${1}/php.ini-dist /etc/php.ini
-
-# To enable PHP support in the Apache web server, a new AddType directive
-# must be added to the httpd.conf file.
-if ! grep "application/x-httpd-php" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
- echo "AddType application/x-httpd-php .php" >> /etc/apache/httpd.conf
-fi
-
-if ! grep "DirectoryIndex" /etc/apache/httpd.conf | grep "index.php" 1> /dev/null 2>&1; then
- sed -i -e "s!\(^DirectoryIndex index.html.*\)!\1 index.php!g" /etc/apache/httpd.conf
-fi
-
-exit $?
+ if ! grep -q "DirectoryIndex" /etc/httpd/httpd.conf | grep "index.php"; then
+ sed -i -e "s!\(^\s*DirectoryIndex index.html.*\)!\1 index.php!g" \
+ /etc/httpd/httpd.conf
+ fi
+ fi
+}