From 5f60735077e132585dcbf34616bb27d3e520d915 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Mon, 13 Jun 2011 17:47:21 +0200 Subject: [PATCH] Dodatne provjere PHP5 postavki uz prikladnu informaciju. --- README.CARNet | 7 ++++++- debian/changelog | 8 ++++++++ debian/config | 9 ++++++++- debian/po/templates.pot | 37 +++++++++++++++++++++++++++++++++++-- debian/postinst | 28 ++++++++++++++++++++++++---- debian/templates | 18 ++++++++++++++++++ 6 files changed, 99 insertions(+), 8 deletions(-) diff --git a/README.CARNet b/README.CARNet index 0667080..07d613b 100644 --- a/README.CARNet +++ b/README.CARNet @@ -21,6 +21,7 @@ datoteci: upload_max_filesize = 256M post_max_size = memory_limit = + error_reporting = E_ERROR post_max_size i memory_limit postavke se odredjuju ovisno o kolicini memorije na posluzitelju, tocnije: @@ -52,5 +53,9 @@ Kako bi Vas Apache2 web server mogao normalno posluzivati stranice pisane u PHP-u, preporuca se da NE brisete i da ne uredjujete navedene datoteke, osim ako znate sto cinite. +Zbog sigurnosnih razloga, paket libapache2-mod-php5 onemogucuje +PHP5 za ~/public_html direktorije ako je omogucen mod_userdir +modul za Apache2. - -- Dragan Dosen Sat, 30 Apr 2011 12:43:54 +0200 + + -- Dragan Dosen Mon, 13 Jun 2011 17:40:42 +0200 diff --git a/debian/changelog b/debian/changelog index ba8cb4d..658ad5c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +php5-cn (5.3.3+3) stable; urgency=low + + * Provjera vrijednosti za error_reporting unutar php.ini datoteka. + * Provjera da li je PHP5 onemogucen za neke direktorije unutar + konfiguracijske datoteke /etc/apache2/mods-enabled/php5.conf. + + -- Dragan Dosen Mon, 13 Jun 2011 17:40:42 +0200 + php5-cn (5.3.3+2) stable; urgency=low * Promjena e-mail adrese odrzavatelja paketa. diff --git a/debian/config b/debian/config index 51ba28c..c8eb010 100755 --- a/debian/config +++ b/debian/config @@ -49,20 +49,23 @@ for SAPI in apache2 cli; do upload_max_filesize= post_max_size= memory_limit= + error_reporting= phplimit="$(phpmemlimit)M" if [ -f "$ini_file" ]; then - if egrep -q "^[[:space:]]*(upload_max_filesize|post_max_size|memory_limit)[[:space:]]*=" $ini_file; then + if egrep -q "^[[:space:]]*(upload_max_filesize|post_max_size|memory_limit|error_reporting)[[:space:]]*=" $ini_file; then upload_max_filesize=`awk '$1 == "upload_max_filesize" { print $3; exit(0) }' $ini_file` post_max_size=`awk '$1 == "post_max_size" { print $3; exit(0) }' $ini_file` memory_limit=`awk '$1 == "memory_limit" { print $3; exit(0) }' $ini_file` + error_reporting=`awk '$1 == "error_reporting" { print $3; exit(0) }' $ini_file` if [ "$upload_max_filesize" != "256M" ]; then ini_diff=1; fi if [ "$post_max_size" != "$phplimit" ]; then ini_diff=1; fi if [ "$memory_limit" != "$phplimit" ]; then ini_diff=1; fi + if [ "$error_reporting" != "E_ERROR" ]; then ini_diff=1; fi else ini_diff=1 @@ -78,6 +81,7 @@ for SAPI in apache2 cli; do test -z "$upload_max_filesize" && upload_max_filesize="2M" test -z "$post_max_size" && post_max_size="8M" test -z "$memory_limit" && memory_limit="16M" + test -z "$error_reporting" && error_reporting="E_ALL & ~E_DEPRECATED" db_title php5-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') db_subst php5-cn/${SAPI} ini_file "$ini_file" @@ -88,6 +92,9 @@ for SAPI in apache2 cli; do db_subst php5-cn/${SAPI} new_phplimit "$phplimit" + db_subst php5-cn/${SAPI} error_reporting "$error_reporting" + db_subst php5-cn/${SAPI} new_error_reporting "E_ERROR" + db_input critical php5-cn/${SAPI} || true db_go || true else diff --git a/debian/po/templates.pot b/debian/po/templates.pot index 9e486ad..e8d2c2c 100644 --- a/debian/po/templates.pot +++ b/debian/po/templates.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: php5-cn@packages.debian.org\n" -"POT-Creation-Date: 2011-04-29 16:26+0200\n" +"POT-Creation-Date: 2011-06-13 17:47+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -40,6 +40,7 @@ msgid "" " upload_max_filesize = ${upload_max_filesize}\n" " post_max_size = ${post_max_size}\n" " memory_limit = ${memory_limit}\n" +" error_reporting = ${error_reporting}\n" "\n" "Preporucamo sljedece:" msgstr "" @@ -52,7 +53,8 @@ msgstr "" msgid "" " upload_max_filesize = 256M\n" " post_max_size = ${new_phplimit}\n" -" memory_limit = ${new_phplimit}" +" memory_limit = ${new_phplimit}\n" +" error_reporting = ${new_error_reporting}" msgstr "" #. Type: boolean @@ -143,3 +145,34 @@ msgid "" "ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno " "ignorirajte ovu poruku." msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "PHP5 nije omogucen za neke direktorije" +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Provjerom trenutne PHP5 konfiguracije za Apache2 (konfiguracijska datoteka " +"${php5_conf}), ustanovljeno je da PHP5 nije omogucen za neke direktorije." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Molimo, svakako provjerite postavke unutar navedene konfiguracijske " +"datoteke. Ako ste sigurni da je ovakva konfiguracija ispravna, slobodno " +"ignorirajte ovu poruku." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Zbog sigurnosnih razloga, paket libapache2-mod-php5 onemogucuje PHP5 za ~/" +"public_html direktorije ako je omogucen mod_userdir modul za Apache2." +msgstr "" diff --git a/debian/postinst b/debian/postinst index f9a78dc..a527e5a 100755 --- a/debian/postinst +++ b/debian/postinst @@ -78,6 +78,17 @@ if [ -e /etc/apache2/apache2.conf ]; then if [ ! -e "$A2MODEDIR/php5.load" ] || [ ! -e "$A2MODEDIR/php5.conf" ]; then cp_echo "CN: Enabling PHP5 module for Apache2 web server" a2enmod php5 >/dev/null || true + + if [ -e "$A2MODEDIR/php5.conf" ]; then + if egrep -qi "^[[:space:]]*php_admin_value engine Off" "$A2MODEDIR/php5.conf"; then + db_fset php5-cn/userdir seen false + db_title php5-cn - konfiguracija + db_subst php5-cn/userdir php5_conf "$A2MODEDIR/php5.conf" + db_input critical php5-cn/userdir || true + db_go || true + fi + fi + need_restart=1 fi fi @@ -100,12 +111,12 @@ for SAPI in apache2 cli; do ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX` if [ "$SAPI" = "cli" ]; then - if [ -f "/usr/share/php5/php.ini-dist.cli" ]; then - cat /usr/share/php5/php.ini-dist.cli > $ini_file_tmp + if [ -f "/usr/share/php5/php.ini-production.cli" ]; then + cat /usr/share/php5/php.ini-production.cli > $ini_file_tmp fi else - if [ -f "/usr/share/php5/php.ini-dist" ]; then - cat /usr/share/php5/php.ini-dist > $ini_file_tmp + if [ -f "/usr/share/php5/php.ini-production" ]; then + cat /usr/share/php5/php.ini-production > $ini_file_tmp fi fi cp_mv $ini_file_tmp $ini_file @@ -184,6 +195,7 @@ done # * upload_max_filesize = 256M # * post_max_size, memory_limit = depends on system memory, we are using # phpmemlimit() function. +# * error_reporting = E_ERROR # for SAPI in apache2 cli; do @@ -212,6 +224,10 @@ for SAPI in apache2 cli; do cp_check_and_sed "^[[:space:]]*memory_limit[[:space:]]*=" \ "s/^[[:space:]]*memory_limit[[:space:]]*=.*/memory_limit = ${phplimit}/" \ "$ini_file" && need_restart=1 || true + + cp_check_and_sed "^[[:space:]]*error_reporting[[:space:]]*=" \ + "s/^[[:space:]]*error_reporting[[:space:]]*=.*/error_reporting = E_ERROR/" \ + "$ini_file" && need_restart=1 || true fi ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX` @@ -231,6 +247,10 @@ for SAPI in apache2 cli; do echo "memory_limit = ${phplimit}" >> "$ini_file_tmp" need_restart=1 fi + if ! egrep -q "^[[:space:]]*error_reporting[[:space:]]*=" $ini_file_tmp; then + echo "error_reporting = E_ERROR" >> "$ini_file_tmp" + need_restart=1 + fi cp_mv "$ini_file_tmp" "$ini_file" chmod 644 "$ini_file" diff --git a/debian/templates b/debian/templates index c628cb7..28d01d3 100644 --- a/debian/templates +++ b/debian/templates @@ -7,12 +7,14 @@ _Description: Zelite li aktivirati preporucene PHP5 postavke za Apache2? upload_max_filesize = ${upload_max_filesize} post_max_size = ${post_max_size} memory_limit = ${memory_limit} + error_reporting = ${error_reporting} Preporucamo sljedece: . upload_max_filesize = 256M post_max_size = ${new_phplimit} memory_limit = ${new_phplimit} + error_reporting = ${new_error_reporting} Template: php5-cn/cli Type: boolean @@ -24,12 +26,14 @@ _Description: Zelite li aktivirati preporucene PHP5 postavke za CLI? upload_max_filesize = ${upload_max_filesize} post_max_size = ${post_max_size} memory_limit = ${memory_limit} + error_reporting = ${error_reporting} Preporucamo sljedece: . upload_max_filesize = 256M post_max_size = ${new_phplimit} memory_limit = ${new_phplimit} + error_reporting = ${new_error_reporting} Template: php5-cn/inivalues Type: note @@ -64,3 +68,17 @@ _Description: Neki dodaci (extensions) za PHP5 nisu ukljuceni Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP5 ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno ignorirajte ovu poruku. + +Template: php5-cn/userdir +Type: note +_Description: PHP5 nije omogucen za neke direktorije + Provjerom trenutne PHP5 konfiguracije za Apache2 (konfiguracijska + datoteka ${php5_conf}), ustanovljeno je da PHP5 nije omogucen za neke + direktorije. + . + Molimo, svakako provjerite postavke unutar navedene konfiguracijske + datoteke. Ako ste sigurni da je ovakva konfiguracija ispravna, slobodno + ignorirajte ovu poruku. + . + Zbog sigurnosnih razloga, paket libapache2-mod-php5 onemogucuje PHP5 za + ~/public_html direktorije ako je omogucen mod_userdir modul za Apache2. -- 1.7.10.4