EXTENSIONS="mysql"
PHP5DIR="/etc/php5"
PHP5CONFD="/etc/php5/conf.d"
+PHP4DIR="/etc/php4"
need_restart=0
echo $memlimit
}
+# phpinivalidate ()
+#
+# Validate php.ini values.
+#
+phpinivalidate () {
+
+ local ini_file
+ ini_file="$1"
+
+ awk -F'[[:space:]]*=[[:space:]]*' \
+ '/^[[:space:]]*[[:alpha:]_]+[[:space:]]*=[[:space:]]*[[:digit:]]+[MGK]B/ {print $1" = "$2}' \
+ "$ini_file"
+}
+
# Disable PHP4 module and enable Apache2 PHP5 module.
#
cp_mv $ini_file_tmp $ini_file
need_restart=1
fi
+ chmod 644 $ini_file
done
if [ -f "$ini_file" ]; then
- cp_echo "CN: Removing $php5ext extension from file $ini_file"
+ if egrep -q "$php5ext_re" "$ini_file"; then
+ cp_echo "CN: Removing $php5ext extension from file $ini_file"
+ fi
cp_check_and_sed "$php5ext_re" \
"/$php5ext_re/d" \
cp_echo "CN: Adding $php5ext extension to file $PHP5CONFD/$php5ext.ini"
- printf "# configuration for php %s module\nextension=%s\n" "${php5ext_up}" "${php5ext}" >> "$INITMP"
+ printf "# configuration for php %s module\nextension=%s.so\n" "${php5ext_up}" "${php5ext}" >> "$INITMP"
cp_mv "$INITMP" "$PHP5CONFD/$php5ext.ini"
need_restart=1
need_restart=1
fi
fi
+ chmod 644 $PHP5CONFD/$php5ext.ini
done
if [ ! -d "$PHP5DIR/$SAPI" ]; then
continue
fi
-
+
+ ini_file="$PHP5DIR/$SAPI/php.ini"
db_get php5-cn/${SAPI} || true
if [ "$RET" = "true" ]; then
- ini_file="$PHP5DIR/$SAPI/php.ini"
-
cp_echo "CN: Checking and enabling some specific parameters in file $ini_file"
phplimit="$(phpmemlimit)M"
need_restart=1
fi
cp_mv "$ini_file_tmp" "$ini_file"
-
-
+ chmod 644 "$ini_file"
+
if [ -e "$ini_file_tmp" ]; then
rm -f "$ini_file_tmp"
fi
fi
+
+ # Validate php.ini values.
+ if [ -f "$ini_file" ]; then
+ php5_inivalues="$(phpinivalidate "$ini_file")"
+ if [ -n "$php5_inivalues" ]; then
+ db_fset php5-cn/inivalues seen false
+ db_title php5-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/')
+ db_subst php5-cn/inivalues php5_sapi $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/')
+ db_subst php5-cn/inivalues ini_file "$ini_file"
+ db_capb escape
+ db_subst php5-cn/inivalues php5_inivalues "$(echo -n "$php5_inivalues" | debconf-escape -e)"
+ db_input critical php5-cn/inivalues || true
+ db_go || true
+ fi
+ fi
done
+# Compare active PHP5 extensions with PHP4 ones, if PHP4 configuration still exists.
+#
+if [ -d "${PHP4DIR}" ] && [ -f "${PHP4DIR}/apache2/php.ini" ]; then
+
+ phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}'
+
+ # Get all active PHP4 extensions.
+ php4_ext="$(find ${PHP4DIR} -type f -name *.ini |
+ egrep "\/(conf\.d|apache2|cli)\/" |
+ xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true
+
+ # Get all active PHP5 extensions.
+ php5_ext=""
+ if [ -d "${PHP5DIR}" ]; then
+ php5_ext="$(find ${PHP5DIR} -type f -name *.ini |
+ egrep "\/(conf\.d|apache2|cli)\/" |
+ xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true
+ fi
+
+ # Compare PHP5 <-> PHP4 extensions.
+ php5_ext_mis=""
+ for ext in $php4_ext; do
+ if [ "$(echo $php5_ext | egrep $ext)" = "" ]; then
+ php5_ext_mis="\n${ext}${php5_ext_mis}"
+ fi
+ done
+
+ # Some PHP5 extensions are not active.
+ if [ -n "$php5_ext_mis" ]; then
+ db_fset php5-cn/extensions seen false
+ db_title php5-cn - konfiguracija
+ db_capb escape
+ db_subst php5-cn/extensions php5_extensions "${php5_ext_mis#*\n}"
+ db_input critical php5-cn/extensions || true
+ db_go || true
+ fi
+fi
+
+
db_stop || true
# Restart Apache2 web server.
if [ -x "/etc/init.d/apache2" ]; then
if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d apache2 force-reload || true
+ invoke-rc.d apache2 restart || true
else
- /etc/init.d/apache2 force-reload || true
+ /etc/init.d/apache2 restart || true
fi
fi
else