From: Ivan Rako Date: Fri, 12 Jul 2019 16:29:06 +0000 (+0200) Subject: inicijalna verzija X-Git-Tag: debian/7.0.33_cn0^0 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=commitdiff_plain;h=HEAD;p=php7.0-cn.git inicijalna verzija --- 81d6ef5497e30accfa1be6edfa9f5f68ccd78654 diff --git a/README.CARNet b/README.CARNet new file mode 100644 index 0000000..7bbe4d1 --- /dev/null +++ b/README.CARNet @@ -0,0 +1,61 @@ +php-cn +~~~~~~ + +Ovaj paket sadrzi dodatne CARNetove postavke za php pakete iz Debian +stretch distribucije. Povlaci za sobom instalaciju dodatka za MySQL +(extension), PHP interpretera za komandnu liniju i PHP modula za web +server Apache2. + + +PHP7 KONFIGURACIJA + +PHP7 konfiguracija nalazi se unutar direktorija /etc/php/7.0/. +U slucaju da zelite prepraviti konfiguraciju za Apache2 web +server, cinite to u datoteci: + + /etc/php/7.0/apache2/php.ini + +Specificne postavke koje paket php7.0-cn postavlja u navedenoj +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: + + * manje od 512MB => ogranicenje 16MB, + * 512-1024MB => ogranicenje 32MB, + * vise od 1024MB => ogranicenje 64MB. + +U slucaju da na posluzitelju postoji PHP7 konfiguracija koja +se razlikuje od navedene, bit cete upitani zelite li zadrzati +trenutne postavke ili aktivirati preporucene. + +Nakon sto prepravite PHP7 konfiguraciju, potrebno je obaviti +restart Apache2 web servera: + + service apache2 restart + + +APACHE2 KONFIGURACIJA + +Konfiguracija modula PHP7 za web server Apache2 nalazi se u +direktoriju /etc/apache2/mods-available/, odnosno u direktoriju +/etc/apache2/mods-enabled/. Radi se o datotekama: + + /etc/apache2/mods-enabled/php7.0.conf + /etc/apache2/mods-enabled/php7.0.load + +Kako bi Vas web server Apache2 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-php7.0 onemogucuje +PHP7 za ~/public_html direktorije ako je omogucen mod_userdir +modul za Apache2. + + + -- Ivan Rako Wed, 10 Jul 2019 17:02:59 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..4bd27be --- /dev/null +++ b/debian/changelog @@ -0,0 +1,163 @@ +php7.0-cn (7.0.33~cn0) stable; urgency=low + + * Prva verzija za stretch + * Promjena imena u php7.0-cn + + -- Ivan Rako Wed, 10 Jul 2019 16:58:12 +0200 + +php5-cn (5.6.24.1) stable; urgency=low + + * Prva inacica za jessie + + -- Zeljko Boros Tue, 06 Sep 2016 11:29:24 +0200 + +php5-cn (5.4.4+4) stable; urgency=low + + * tag fix + + -- Zeljko Boros Thu, 07 Nov 2013 13:51:30 +0100 + +php5-cn (5.4.4+3) stable; urgency=low + + * debhelper >= 9 + * Izbaceno dodavanje ekstenzije mysql u /etc/php5/conf.d/php.ini + * Dodano brisanje _obsolete_ datoteke php.ini + + -- Zeljko Boros Thu, 07 Nov 2013 12:41:30 +0100 + +php5-cn (5.4.4+2) stable; urgency=low + + * Ispravke za lintian. + + -- Valentin Vidic Tue, 22 Oct 2013 11:17:14 +0200 + +php5-cn (5.4.4+1) stable; urgency=low + + * Nova verzija za wheezy: izbacen suhosin paket. + * Ispravljena greska u predlosku. + + -- Valentin Vidic Thu, 17 Oct 2013 14:53:04 +0200 + +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. + + -- Dragan Dosen Sat, 30 Apr 2011 12:43:54 +0200 + +php5-cn (5.3.3+1) stable; urgency=low + + * Prva inacica paketa za Debian squeeze distribuciju. + * Nova debian/rules datoteka. + * Azurirane ovisnosti unutar debian/control. + * Razni Lintian popravci, dodan copyright, promjena inacice + paketa u Debian native. + * Azurirana debian/templates datoteka. + + -- Dragan Dosen Fri, 29 Apr 2011 15:51:33 +0200 + +php5-cn (5.2.6-1) stable; urgency=low + + * Upgrade paketa za Debian lenny. + * Podesene nove ovisnosti u debian/control, dodana preporuka + za php-apc. + * Umjesto 'apache2 force-reload' koristi se 'apache2 restart'. + + -- Dragan Dosen Sat, 18 Apr 2009 19:42:19 +0200 + +php5-cn (5.2.0-7) stable; urgency=low + + * Paket za buduci prelazak na Debian Lenny. + * debian/postinst datoteka: + + u slucaju da na sustavu postoji PHP4 konfiguracija, obavlja + se provjera aktivnih dodataka za PHP4 - korisnik je + informiran ako odgovarajuci dodaci nisu aktivirani za PHP5. + * debian/templates datoteka: + + novi predlozak php5-cn/extensions, + + manje izmjene za predlozak php5-cn/inivalues. + * debian/control datoteka: + + dodana ovisnost o findutils paketu. + + -- Dragan Dosen Wed, 11 Feb 2009 20:13:35 +0100 + +php5-cn (5.2.0-6) stable; urgency=low + + * debian/postinst datoteka: + + provjera ispravnosti za postavke unutar php.ini + konfiguracijske datoteke - vrijednosti za postavke kao sto + su upload_max_filesize, post_max_size, memory_limit, ne + smiju zavrsavati sa 'B'; dozvoljene oznake su 'K' (kilo), + 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte' - korisnik je + informiran da provjeri konfiguraciju. (rijeseno: #3938) + + koristi se debconf-escape za ispis pogresno podesenih + postavki unutar php.ini datoteke. + * debian/control - ovisnost o debconf (>= 1.4.72). + + -- Dragan Dosen Tue, 2 Sep 2008 21:29:03 +0200 + +php5-cn (5.2.0-5) stable; urgency=medium + + * dodana config skripta: + + usporedba trenutno aktivnih PHP5 postavki s onima koje + preporuca CARNet (upload_max_filesize, post_max_size, + memory_limit) + + koristi se debconf - u slucaju da se postavke razlikuju, + korisnik odlucuje zeli li zadrzati trenutne postavke ili + aktivirati preporucene + * config i postinst skripta - preporucene vrijednosti za + post_max_size i memory_limit postavke odredjuju se ovisno o + kolicini memorije na posluzitelju. + * u slucaju da ne postoji neka od php.ini datoteka, koristi + se /usr/share/php5/php.ini-dist za kreiranje nove. + * podesavanje postavki (php.ini datoteka/e) odvija se samo kod + prve instalacije paketa ili u slucaju da se pokrene + dpkg-reconfigure. + * README.CARNet datoteka - opisano odredjivanje preporucene + vrijednosti za post_max_size i memory_limit postavke. + * provjera dozvola pristupa za svaku PHP5 konfiguracijsku + datoteku (file access permissions, chmod 644). + + -- Dragan Dosen Sun, 30 Mar 2008 22:10:32 +0200 + +php5-cn (5.2.0-4) stable; urgency=low + + * control datoteka - uklonjene ovisnosti o php5-cgi, php5-gd, + php5-ldap i libpcre3. + * izmjene unutar postinst skripte - vrsi se podesavanje samo + MySQL PHP5 dodatka (extension), posto vise ne ovisimo o + LDAP i GD. + * manje izmjene unutar README.CARNet datoteke. + + -- Dragan Dosen Sun, 27 Jan 2008 14:54:24 +0100 + +php5-cn (5.2.0-3) stable; urgency=low + + * control datoteka, uklonjeno: + Pre-Depends: apache2-cn, apache2.2-common + + -- Dragan Dosen Wed, 9 Jan 2008 14:33:16 +0100 + +php5-cn (5.2.0-2) stable; urgency=low + + * control datoteka, dodano: Conflicts: php4-cn + + -- Dragan Dosen Thu, 27 Dec 2007 16:59:15 +0100 + +php5-cn (5.2.0-1) stable; urgency=low + + * Inicijalni paket za Debian etch distribuciju + * Automatska aktivacija PHP5 modula za Apache2 web server; + PHP4 modul se vise ne koristi. + * Aktivacija PHP5 dodataka za MySQL, LDAP i GD - provjera + konfiguracije. + * Aktivacija specificnih CARNet parametara unutar php.ini. + + -- Dragan Dosen Sat, 27 Oct 2007 15:51:58 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/config b/debian/config new file mode 100755 index 0000000..7ee5319 --- /dev/null +++ b/debian/config @@ -0,0 +1,108 @@ +#!/bin/sh + +set -e + +# Load debconf +. /usr/share/debconf/confmodule + +if [ "$1" != reconfigure ]; then + + php70_done=1 + + for SAPI in apache2 cli; do + db_fget php7.0-cn/${SAPI} seen + if [ "$RET" != "true" ]; then + php70_done=0 + break + fi + done + + test $php70_done -eq 1 && exit 0 +fi + +PHP70DIR="/etc/php/7.0" + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + echo $memlimit +} + + +# Check for PHP5 SAPI configuration. +# +for SAPI in apache2 cli; do + + ini_diff=0 + ini_file="$PHP70DIR/$SAPI/php.ini" + + 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|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 + fi + else + + ini_diff=1 + fi + + if [ $ini_diff -eq 1 ]; then + + # Configurations are not the same - ask user what to 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 php7.0-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/${SAPI} ini_file "$ini_file" + + db_subst php7.0-cn/${SAPI} upload_max_filesize "$upload_max_filesize" + db_subst php7.0-cn/${SAPI} post_max_size "$post_max_size" + db_subst php7.0-cn/${SAPI} memory_limit "$memory_limit" + + db_subst php7.0-cn/${SAPI} new_phplimit "$phplimit" + + db_subst php7.0-cn/${SAPI} error_reporting "$error_reporting" + db_subst php7.0-cn/${SAPI} new_error_reporting "E_ERROR" + + db_input critical php7.0-cn/${SAPI} || true + db_go || true + else + + db_set php7.0-cn/${SAPI} false || true + db_fset php7.0-cn/${SAPI} seen true + fi + +done + +exit 0 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..2c93ca2 --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: php7.0-cn +Section: php +Priority: optional +Maintainer: Ivan Rako +Uploaders: Valentin Vidic , Zeljko Boros +Build-Depends: debhelper (>= 9), po-debconf +Standards-Version: 3.9.8 + +Package: php7.0-cn +Architecture: all +Pre-Depends: findutils (>= 4.6.0+git+20161106-2) +Depends: libapache2-mod-php7.0 (>= 7.0.33-0+deb9u3), php7.0-cli (>= 7.0.33-0+deb9u3), php7.0-mysql (>= 7.0.33-0+deb9u3), carnet-tools-cn (>= 3.2.1), ${misc:Depends} +Conflicts: php4-cn, php5-cn +Description: server-side, HTML-embedded scripting language + PHP7 is a widely-used general-purpose scripting language that is + especially suited for Web development and can be embedded into HTML. + The goal of the language is to allow web developers to write + dynamically generated pages quickly. This version of PHP7 was built + with the Suhosin patch. + . + This package is a meta-package that contains additional CARNet configuration. + Removing this package won't remove PHP7 from your system, however it may + remove other packages that depend on this one. +Homepage: http://www.php.net/ diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..5350ae7 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,7 @@ +Copyright 2011 CARNet + +You are free to distribute this software package under the terms of the +GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file /usr/share/common-licenses/GPL. diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 0000000..a31fa47 --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +php7.0-cn diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..8f6e250 --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.CARNet diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..819766f --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +php7.0-cn_7.0.33~cn0_all.deb php optional +php7.0-cn_7.0.33~cn0_amd64.buildinfo php optional diff --git a/debian/php7.0-cn.debhelper.log b/debian/php7.0-cn.debhelper.log new file mode 100644 index 0000000..2ecc585 --- /dev/null +++ b/debian/php7.0-cn.debhelper.log @@ -0,0 +1,19 @@ +dh_update_autotools_config +dh_auto_configure +dh_auto_build +dh_auto_test +dh_prep +dh_auto_install +dh_installdocs +dh_installchangelogs +dh_installdebconf +dh_perl +dh_link +dh_strip_nondeterminism +dh_compress +dh_fixperms +dh_installdeb +dh_gencontrol +dh_md5sums +dh_builddeb +dh_builddeb diff --git a/debian/php7.0-cn.postrm.debhelper b/debian/php7.0-cn.postrm.debhelper new file mode 100644 index 0000000..bc035b9 --- /dev/null +++ b/debian/php7.0-cn.postrm.debhelper @@ -0,0 +1,6 @@ +# Automatically added by dh_installdebconf +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +# End automatically added section diff --git a/debian/php7.0-cn.substvars b/debian/php7.0-cn.substvars new file mode 100644 index 0000000..a595723 --- /dev/null +++ b/debian/php7.0-cn.substvars @@ -0,0 +1,2 @@ +misc:Depends=debconf (>= 0.5) | debconf-2.0 +misc:Pre-Depends= diff --git a/debian/php7.0-cn/DEBIAN/config b/debian/php7.0-cn/DEBIAN/config new file mode 100755 index 0000000..7ee5319 --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/config @@ -0,0 +1,108 @@ +#!/bin/sh + +set -e + +# Load debconf +. /usr/share/debconf/confmodule + +if [ "$1" != reconfigure ]; then + + php70_done=1 + + for SAPI in apache2 cli; do + db_fget php7.0-cn/${SAPI} seen + if [ "$RET" != "true" ]; then + php70_done=0 + break + fi + done + + test $php70_done -eq 1 && exit 0 +fi + +PHP70DIR="/etc/php/7.0" + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + echo $memlimit +} + + +# Check for PHP5 SAPI configuration. +# +for SAPI in apache2 cli; do + + ini_diff=0 + ini_file="$PHP70DIR/$SAPI/php.ini" + + 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|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 + fi + else + + ini_diff=1 + fi + + if [ $ini_diff -eq 1 ]; then + + # Configurations are not the same - ask user what to 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 php7.0-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/${SAPI} ini_file "$ini_file" + + db_subst php7.0-cn/${SAPI} upload_max_filesize "$upload_max_filesize" + db_subst php7.0-cn/${SAPI} post_max_size "$post_max_size" + db_subst php7.0-cn/${SAPI} memory_limit "$memory_limit" + + db_subst php7.0-cn/${SAPI} new_phplimit "$phplimit" + + db_subst php7.0-cn/${SAPI} error_reporting "$error_reporting" + db_subst php7.0-cn/${SAPI} new_error_reporting "E_ERROR" + + db_input critical php7.0-cn/${SAPI} || true + db_go || true + else + + db_set php7.0-cn/${SAPI} false || true + db_fset php7.0-cn/${SAPI} seen true + fi + +done + +exit 0 diff --git a/debian/php7.0-cn/DEBIAN/control b/debian/php7.0-cn/DEBIAN/control new file mode 100644 index 0000000..f06171b --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/control @@ -0,0 +1,21 @@ +Package: php7.0-cn +Version: 7.0.33~cn0 +Architecture: all +Maintainer: Ivan Rako +Installed-Size: 31 +Pre-Depends: findutils (>= 4.6.0+git+20161106-2) +Depends: libapache2-mod-php7.0 (>= 7.0.33-0+deb9u3), php7.0-cli (>= 7.0.33-0+deb9u3), php7.0-mysql (>= 7.0.33-0+deb9u3), carnet-tools-cn (>= 3.2.1), debconf (>= 0.5) | debconf-2.0 +Conflicts: php4-cn, php5-cn +Section: php +Priority: optional +Homepage: http://www.php.net/ +Description: server-side, HTML-embedded scripting language + PHP7 is a widely-used general-purpose scripting language that is + especially suited for Web development and can be embedded into HTML. + The goal of the language is to allow web developers to write + dynamically generated pages quickly. This version of PHP7 was built + with the Suhosin patch. + . + This package is a meta-package that contains additional CARNet configuration. + Removing this package won't remove PHP7 from your system, however it may + remove other packages that depend on this one. diff --git a/debian/php7.0-cn/DEBIAN/md5sums b/debian/php7.0-cn/DEBIAN/md5sums new file mode 100644 index 0000000..d466ca3 --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/md5sums @@ -0,0 +1,3 @@ +a46297c96e4ee47abf4709399ec0aafd usr/share/doc/php7.0-cn/README.CARNet +fbf235ca71d81aa73b2352bd2d9a653e usr/share/doc/php7.0-cn/changelog.gz +e2cd8d153f5ec9a3162546ee1d61a231 usr/share/doc/php7.0-cn/copyright diff --git a/debian/php7.0-cn/DEBIAN/postinst b/debian/php7.0-cn/DEBIAN/postinst new file mode 100755 index 0000000..c197484 --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/postinst @@ -0,0 +1,356 @@ +#!/bin/sh + +set -e + +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx + +case "$1" in + configure) + # continue below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + + +# Load debconf +. /usr/share/debconf/confmodule + +# Include CARNet functions +. /usr/share/carnet-tools/functions.sh + +PKG="php7.0-cn" +A2MODEDIR="/etc/apache2/mods-enabled" +### mysql je vec ukljucen u wheezyu +### EXTENSIONS="mysql" +EXTENSIONS="" +PHP70DIR="/etc/php/7.0" +PHP70MODADIR="$PHP70DIR/mods-available" +PHP70CONFD="/etc/php/7.0/conf.d" +PHP5DIR="/etc/php5" + +need_restart=0 + + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + 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 PHP5 module and enable Apache2 PHP7 module. +# +if [ -e /etc/apache2/apache2.conf ]; then + if [ -e "$A2MODEDIR/php5.load" ]; then + cp_echo "CN: Disabling PHP5 module for Apache2 web server" + a2dismod php5 >/dev/null || true + need_restart=1 + fi + if [ ! -e "$A2MODEDIR/php7.0.load" ] || [ ! -e "$A2MODEDIR/php7.0.conf" ]; then + cp_echo "CN: Enabling PHP7 module for Apache2 web server" + a2enmod php7.0 >/dev/null || true + + if [ -e "$A2MODEDIR/php7.0.conf" ]; then + if egrep -qi "^[[:space:]]*php_admin_value engine Off" "$A2MODEDIR/php7.0.conf"; then + db_fset php7.0-cn/userdir seen false + db_title php7.0-cn - konfiguracija + db_subst php7.0-cn/userdir php70_conf "$A2MODEDIR/php5.conf" + db_input critical php7.0-cn/userdir || true + db_go || true + fi + fi + + need_restart=1 + fi +fi + + +# Check for PHP7 SAPI directories and configuration files. +# +for SAPI in apache2 cli; do + + if [ ! -d "$PHP70DIR/$SAPI" ]; then + cp_echo "CN: Creating configuration directory $PHP70DIR/$SAPI/" + mkdir -p $PHP70DIR/$SAPI/ + fi + + ini_file="$PHP70DIR/$SAPI/php.ini" + + if [ ! -f "$ini_file" ]; then + + cp_echo "CN: Generating configuration file $ini_file" + + ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX` + if [ "$SAPI" = "cli" ]; then + if [ -f "/usr/lib/php/7.0/php.ini-production.cli" ]; then + cat /usr/lib/php/7.0/php.ini-production.cli > $ini_file_tmp + fi + else + if [ -f "/usr/lib/php/7.0/php.ini-production" ]; then + cat /usr/lib/php/7.0/php.ini-production > $ini_file_tmp + fi + fi + cp_mv $ini_file_tmp $ini_file + need_restart=1 + fi + chmod 644 $ini_file +done + + +# Check for /etc/php/7.0/conf.d/ directory. +# +if [ ! -d "$PHP70CONFD" ]; then + cp_echo "CN: Creating configuration directory $PHP70CONFD" + mkdir -p $PHP70CONFD/ +fi + +# Brisanje obsolete datoteke mysql.ini u $PHP70CONFD +# +if [ -f "$PHP70CONFD/mysql.ini" ]; then + # just to make sure mysql is included in _new-style_ configuration + if [ -f "$PHP70MODADIR/mysql.ini" ]; then + cp_echo "CN: Removing obsolete $PHP70CONFD/mysql.ini" + rm -f $PHP70CONFD/mysql.ini + else + cp_echo "CN: WARNING: Obsolete $PHP70CONFD/mysql.ini present, and no $PHP70MODADIR/mysql.ini!" + fi +fi + +# Check if PHP7 extensions are enabled. +# +for php70ext in $EXTENSIONS; do + + php70ext_re="^[[:space:]]*extension[[:space:]]*=[[:space:]]*$php70ext\.so" + + # Remove extension entry from /etc/php/7.0/(apache2|cli).ini + # configuration files. + for SAPI in apache2 cli; do + + ini_file="$PHP70DIR/$SAPI/php.ini" + + if [ -f "$ini_file" ]; then + + if egrep -q "$php70ext_re" "$ini_file"; then + cp_echo "CN: Removing $php70ext extension from file $ini_file" + fi + + cp_check_and_sed "$php70ext_re" \ + "/$php70ext_re/d" \ + "$ini_file" && need_restart=1 || true + fi + done + + # Check extension configuration in /etc/php/7.0/conf.d/ directory. + if [ ! -f "$PHP70CONFD/$php70ext.ini" ]; then + + cp_echo "CN: Creating configuration file $PHP70CONFD/$php70ext.ini" + + php5ext_up=`echo $php70ext | tr [:lower:] [:upper:] | sed 's/Y/y/'` + INITMP=`mktemp $PHP70CONFD/$php70ext.ini.tmp.XXXXXX` + + cp_echo "CN: Adding $php70ext extension to file $PHP70CONFD/$php70ext.ini" + + printf "# configuration for php %s module\nextension=%s.so\n" "${php70ext_up}" "${php5ext}" >> "$INITMP" + cp_mv "$INITMP" "$PHP70CONFD/$php70ext.ini" + + need_restart=1 + else + + if ! grep -q "$php70ext_re" "$PHP70CONFD/$php70ext.ini"; then + + cp_echo "CN: Adding $php70ext extension to file $PHP70CONFD/$php70ext.ini" + + INITMP=`mktemp $PHP70CONFD/$php70ext.ini.tmp.XXXXXX` + cat "$PHP70CONFD/$php70ext.ini" > "$INITMP" + echo "extension=$php70ext.so" >> "$INITMP" + cp_mv "$INITMP" "$PHP70CONFD/$php70ext.ini" + + need_restart=1 + fi + fi + chmod 644 $PHP70CONFD/$php70ext.ini +done + + +# Enable some PHP7 tweaks for Apache2 web server (/etc/php/7.0/apache2/php.ini). +# +# * 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 + + if [ ! -d "$PHP70DIR/$SAPI" ]; then + continue + fi + + ini_file="$PHP70DIR/$SAPI/php.ini" + db_get php7.0-cn/${SAPI} || true + if [ "$RET" = "true" ]; then + + cp_echo "CN: Checking and enabling some specific parameters in file $ini_file" + + phplimit="$(phpmemlimit)M" + + if [ -f "$ini_file" ]; then + + cp_check_and_sed "^[[:space:]]*upload_max_filesize[[:space:]]*=" \ + 's/^[[:space:]]*upload_max_filesize[[:space:]]*=.*/upload_max_filesize = 256M/' \ + "$ini_file" && need_restart=1 || true + + cp_check_and_sed "^[[:space:]]*post_max_size[[:space:]]*=" \ + "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${phplimit}/" \ + "$ini_file" && need_restart=1 || true + + 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` + if [ -f "$ini_file" ]; then + cat $ini_file > $ini_file_tmp + fi + + if ! egrep -q "^[[:space:]]*upload_max_filesize[[:space:]]*=" $ini_file_tmp; then + echo "upload_max_filesize = 256M" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*post_max_size[[:space:]]*=" $ini_file_tmp; then + echo "post_max_size = ${phplimit}" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*memory_limit[[:space:]]*=" $ini_file_tmp; then + 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" + + if [ -e "$ini_file_tmp" ]; then + rm -f "$ini_file_tmp" + fi + fi + + # Validate php.ini values. + if [ -f "$ini_file" ]; then + php70_inivalues="$(phpinivalidate "$ini_file")" + if [ -n "$php70_inivalues" ]; then + db_fset php7.0-cn/inivalues seen false + db_title php7.0-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/inivalues php70_sapi $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/inivalues ini_file "$ini_file" + db_capb escape + db_subst php7.0-cn/inivalues php70_inivalues "$(echo -n "$php70_inivalues" | debconf-escape -e)" + db_input critical php7.0-cn/inivalues || true + db_go || true + fi + fi +done + + +# Compare active PHP7 extensions with PHP5 ones, if PHP5 configuration still exists. +# +if [ -d "${PHP5DIR}" ] && [ -f "${PHP5DIR}/apache2/php.ini" ]; then + + phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}' + + # Get all active PHP5 extensions. + php5_ext="$(find ${PHP5DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + + # Get all active PHP7 extensions. + php70_ext="" + if [ -d "${PHP5DIR}" ]; then + php70_ext="$(find ${PHP70DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + fi + + # Compare PHP7 <-> PHP5 extensions. + php70_ext_mis="" + for ext in $php5_ext; do + if [ "$(echo $php70_ext | egrep $ext)" = "" ]; then + php70_ext_mis="\n${ext}${php70_ext_mis}" + fi + done + + # Some PHP7 extensions are not active. + if [ -n "$php70_ext_mis" ]; then + db_fset php7.0-cn/extensions seen false + db_title php7.0-cn - konfiguracija + db_capb escape + db_subst php7.0-cn/extensions php70_extensions "${php70_ext_mis#*\n}" + db_input critical php7.0-cn/extensions || true + db_go || true + fi +fi + + +db_stop || true + + +# Restart Apache2 web server if needed. +# +if [ $need_restart -eq 1 ]; then + + # Check Apache2 web server configuration. + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + else + # Something is broken. + cp_echo "CN: Your Apache2 configuration is broken." + cp_echo "CN: Please, check the service after the installation finishes!" + fi +fi + + +# Mail root +# +cp_mail "$PKG" + + + +exit 0 diff --git a/debian/php7.0-cn/DEBIAN/postrm b/debian/php7.0-cn/DEBIAN/postrm new file mode 100755 index 0000000..f206735 --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/postrm @@ -0,0 +1,13 @@ +#!/bin/sh + +set -e + +# Automatically added by dh_installdebconf +if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then + . /usr/share/debconf/confmodule + db_purge +fi +# End automatically added section + + +exit 0 diff --git a/debian/php7.0-cn/DEBIAN/templates b/debian/php7.0-cn/DEBIAN/templates new file mode 100644 index 0000000..aaae817 --- /dev/null +++ b/debian/php7.0-cn/DEBIAN/templates @@ -0,0 +1,84 @@ +Template: php7.0-cn/apache2 +Type: boolean +Description: Zelite li aktivirati preporucene PHP7 postavke za Apache2? + Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da su sljedece postavke aktivne: + . + 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: php7.0-cn/cli +Type: boolean +Description: Zelite li aktivirati preporucene PHP7 postavke za CLI? + Provjerom trenutne PHP7 konfiguracije za CLI (PHP interpreter + za komandnu liniju, konfiguracijska datoteka ${ini_file}), + ustanovljeno je da su sljedece postavke aktivne: + . + 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: php7.0-cn/inivalues +Type: note +Description: Postavke unutar PHP7 konfiguracije nisu ispravne + Provjerom trenutne PHP7 konfiguracije za ${php70_sapi} (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne: + . + ${php70_inivalues} + . + Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene + oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako provjerite postavke + unutar navedene datoteke kako bi aplikacije (kao sto je Squirrelmail) mogle + normalno funkcionirati. + +Template: php7.0-cn/extensions +Type: note +Description: Neki dodaci (extensions) za PHP7 nisu ukljuceni + Iako je PHP5 uklonjen sa sustava, ostala je njegova konfiguracija. Usporedbom + trenutnih PHP5 i PHP7 konfiguracijskih datoteka, ustanovljeno je da sljedeci + PHP7 dodaci (extensions) nisu ukljuceni, iako su ukljuceni za PHP5: + . + ${php70_extensions} + . + Kako su neki od dodataka ukljuceni u PHP5 konfiguraciji, postoji mogucnost da + pojedine aplikacije zahtjevaju odgovarajuce dodatke za PHP7. Primjerice, ako + je u PHP5 konfiguraciji bio ukljucen dodatak za LDAP (php5-ldap), tada je + u PHP7 konfiguraciji potrebno ukljuciti PHP7 dodatak za LDAP (php7.0-ldap). Molimo, + svakako provjerite PHP7 postavke kako bi PHP aplikacije koje se koriste na + posluzitelju mogle normalno funkcionirati. + . + Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP7 + ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno + ignorirajte ovu poruku. + +Template: php7.0-cn/userdir +Type: note +Description: PHP7 nije omogucen za neke direktorije + Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska + datoteka ${php70_conf}), ustanovljeno je da PHP7 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-php7.0 onemogucuje PHP7 za + ~/public_html direktorije ako je omogucen mod_userdir modul za Apache2. diff --git a/debian/php7.0-cn/usr/share/doc/php7.0-cn/README.CARNet b/debian/php7.0-cn/usr/share/doc/php7.0-cn/README.CARNet new file mode 100644 index 0000000..7bbe4d1 --- /dev/null +++ b/debian/php7.0-cn/usr/share/doc/php7.0-cn/README.CARNet @@ -0,0 +1,61 @@ +php-cn +~~~~~~ + +Ovaj paket sadrzi dodatne CARNetove postavke za php pakete iz Debian +stretch distribucije. Povlaci za sobom instalaciju dodatka za MySQL +(extension), PHP interpretera za komandnu liniju i PHP modula za web +server Apache2. + + +PHP7 KONFIGURACIJA + +PHP7 konfiguracija nalazi se unutar direktorija /etc/php/7.0/. +U slucaju da zelite prepraviti konfiguraciju za Apache2 web +server, cinite to u datoteci: + + /etc/php/7.0/apache2/php.ini + +Specificne postavke koje paket php7.0-cn postavlja u navedenoj +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: + + * manje od 512MB => ogranicenje 16MB, + * 512-1024MB => ogranicenje 32MB, + * vise od 1024MB => ogranicenje 64MB. + +U slucaju da na posluzitelju postoji PHP7 konfiguracija koja +se razlikuje od navedene, bit cete upitani zelite li zadrzati +trenutne postavke ili aktivirati preporucene. + +Nakon sto prepravite PHP7 konfiguraciju, potrebno je obaviti +restart Apache2 web servera: + + service apache2 restart + + +APACHE2 KONFIGURACIJA + +Konfiguracija modula PHP7 za web server Apache2 nalazi se u +direktoriju /etc/apache2/mods-available/, odnosno u direktoriju +/etc/apache2/mods-enabled/. Radi se o datotekama: + + /etc/apache2/mods-enabled/php7.0.conf + /etc/apache2/mods-enabled/php7.0.load + +Kako bi Vas web server Apache2 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-php7.0 onemogucuje +PHP7 za ~/public_html direktorije ako je omogucen mod_userdir +modul za Apache2. + + + -- Ivan Rako Wed, 10 Jul 2019 17:02:59 +0200 diff --git a/debian/php7.0-cn/usr/share/doc/php7.0-cn/changelog.gz b/debian/php7.0-cn/usr/share/doc/php7.0-cn/changelog.gz new file mode 100644 index 0000000..dc1bf08 Binary files /dev/null and b/debian/php7.0-cn/usr/share/doc/php7.0-cn/changelog.gz differ diff --git a/debian/php7.0-cn/usr/share/doc/php7.0-cn/copyright b/debian/php7.0-cn/usr/share/doc/php7.0-cn/copyright new file mode 100644 index 0000000..5350ae7 --- /dev/null +++ b/debian/php7.0-cn/usr/share/doc/php7.0-cn/copyright @@ -0,0 +1,7 @@ +Copyright 2011 CARNet + +You are free to distribute this software package under the terms of the +GNU General Public License. + +On Debian systems, the complete text of the GNU General Public +License can be found in the file /usr/share/common-licenses/GPL. diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in new file mode 100644 index 0000000..cef83a3 --- /dev/null +++ b/debian/po/POTFILES.in @@ -0,0 +1 @@ +[type: gettext/rfc822deb] templates diff --git a/debian/po/templates.pot b/debian/po/templates.pot new file mode 100644 index 0000000..8872459 --- /dev/null +++ b/debian/po/templates.pot @@ -0,0 +1,184 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the php7.0-cn package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: php7.0-cn\n" +"Report-Msgid-Bugs-To: php7.0-cn@packages.debian.org\n" +"POT-Creation-Date: 2019-07-10 17:12+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Type: boolean +#. Description +#: ../templates:1001 +msgid "Zelite li aktivirati preporucene PHP7 postavke za Apache2?" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:1001 +msgid "" +"Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska datoteka " +"${ini_file}), ustanovljeno je da su sljedece postavke aktivne:" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "" +" upload_max_filesize = ${upload_max_filesize}\n" +" post_max_size = ${post_max_size}\n" +" memory_limit = ${memory_limit}\n" +" error_reporting = ${error_reporting}" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "Preporucamo sljedece:" +msgstr "" + +#. Type: boolean +#. Description +#. Type: boolean +#. Description +#: ../templates:1001 ../templates:2001 +msgid "" +" upload_max_filesize = 256M\n" +" post_max_size = ${new_phplimit}\n" +" memory_limit = ${new_phplimit}\n" +" error_reporting = ${new_error_reporting}" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "Zelite li aktivirati preporucene PHP7 postavke za CLI?" +msgstr "" + +#. Type: boolean +#. Description +#: ../templates:2001 +msgid "" +"Provjerom trenutne PHP7 konfiguracije za CLI (PHP interpreter za komandnu " +"liniju, konfiguracijska datoteka ${ini_file}), ustanovljeno je da su " +"sljedece postavke aktivne:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "Postavke unutar PHP7 konfiguracije nisu ispravne" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "" +"Provjerom trenutne PHP7 konfiguracije za ${php70_sapi} (konfiguracijska " +"datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "${php70_inivalues}" +msgstr "" + +#. Type: note +#. Description +#: ../templates:3001 +msgid "" +"Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene " +"oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U " +"protivnom, kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako " +"provjerite postavke unutar navedene datoteke kako bi aplikacije (kao sto je " +"Squirrelmail) mogle normalno funkcionirati." +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "Neki dodaci (extensions) za PHP7 nisu ukljuceni" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Iako je PHP5 uklonjen sa sustava, ostala je njegova konfiguracija. " +"Usporedbom trenutnih PHP5 i PHP7 konfiguracijskih datoteka, ustanovljeno je " +"da sljedeci PHP7 dodaci (extensions) nisu ukljuceni, iako su ukljuceni za " +"PHP5:" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "${php70_extensions}" +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Kako su neki od dodataka ukljuceni u PHP5 konfiguraciji, postoji mogucnost " +"da pojedine aplikacije zahtjevaju odgovarajuce dodatke za PHP7. Primjerice, " +"ako je u PHP5 konfiguraciji bio ukljucen dodatak za LDAP (php5-ldap), tada " +"je u PHP7 konfiguraciji potrebno ukljuciti PHP7 dodatak za LDAP (php7.0-" +"ldap). Molimo, svakako provjerite PHP7 postavke kako bi PHP aplikacije koje " +"se koriste na posluzitelju mogle normalno funkcionirati." +msgstr "" + +#. Type: note +#. Description +#: ../templates:4001 +msgid "" +"Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP7 " +"ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno " +"ignorirajte ovu poruku." +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "PHP7 nije omogucen za neke direktorije" +msgstr "" + +#. Type: note +#. Description +#: ../templates:5001 +msgid "" +"Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska datoteka " +"${php70_conf}), ustanovljeno je da PHP7 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-php7.0 onemogucuje PHP7 za ~/" +"public_html direktorije ako je omogucen mod_userdir modul za Apache2." +msgstr "" diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..9c088bd --- /dev/null +++ b/debian/postinst @@ -0,0 +1,356 @@ +#!/bin/sh + +set -e + +[ "$DEBIAN_SCRIPT_DEBUG" ] && set -vx + +case "$1" in + configure) + # continue below + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 0 + ;; +esac + + +# Load debconf +. /usr/share/debconf/confmodule + +# Include CARNet functions +. /usr/share/carnet-tools/functions.sh + +PKG="php7.0-cn" +A2MODEDIR="/etc/apache2/mods-enabled" +### mysql je vec ukljucen u wheezyu +### EXTENSIONS="mysql" +EXTENSIONS="" +PHP70DIR="/etc/php/7.0" +PHP70MODADIR="$PHP70DIR/mods-available" +PHP70CONFD="/etc/php/7.0/conf.d" +PHP5DIR="/etc/php5" + +need_restart=0 + + +# phpmemlimit () +# +# Calculate memory size for PHP memory_limit option. +# +phpmemlimit () { + + local memtotal memlimit + memtotal=`awk 'tolower($1) == "memtotal:" { printf("%i", $2/1024); }' /proc/meminfo` + + if [ $memtotal -lt 512 ]; then memlimit=16; fi + if [ $memtotal -ge 512 ]; then memlimit=32; fi + if [ $memtotal -gt 1024 ]; then memlimit=64; fi + + 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 PHP5 module and enable Apache2 PHP7 module. +# +if [ -e /etc/apache2/apache2.conf ]; then + if [ -e "$A2MODEDIR/php5.load" ]; then + cp_echo "CN: Disabling PHP5 module for Apache2 web server" + a2dismod php5 >/dev/null || true + need_restart=1 + fi + if [ ! -e "$A2MODEDIR/php7.0.load" ] || [ ! -e "$A2MODEDIR/php7.0.conf" ]; then + cp_echo "CN: Enabling PHP7 module for Apache2 web server" + a2enmod php7.0 >/dev/null || true + + if [ -e "$A2MODEDIR/php7.0.conf" ]; then + if egrep -qi "^[[:space:]]*php_admin_value engine Off" "$A2MODEDIR/php7.0.conf"; then + db_fset php7.0-cn/userdir seen false + db_title php7.0-cn - konfiguracija + db_subst php7.0-cn/userdir php70_conf "$A2MODEDIR/php5.conf" + db_input critical php7.0-cn/userdir || true + db_go || true + fi + fi + + need_restart=1 + fi +fi + + +# Check for PHP7 SAPI directories and configuration files. +# +for SAPI in apache2 cli; do + + if [ ! -d "$PHP70DIR/$SAPI" ]; then + cp_echo "CN: Creating configuration directory $PHP70DIR/$SAPI/" + mkdir -p $PHP70DIR/$SAPI/ + fi + + ini_file="$PHP70DIR/$SAPI/php.ini" + + if [ ! -f "$ini_file" ]; then + + cp_echo "CN: Generating configuration file $ini_file" + + ini_file_tmp=`mktemp $ini_file.tmp.XXXXXX` + if [ "$SAPI" = "cli" ]; then + if [ -f "/usr/lib/php/7.0/php.ini-production.cli" ]; then + cat /usr/lib/php/7.0/php.ini-production.cli > $ini_file_tmp + fi + else + if [ -f "/usr/lib/php/7.0/php.ini-production" ]; then + cat /usr/lib/php/7.0/php.ini-production > $ini_file_tmp + fi + fi + cp_mv $ini_file_tmp $ini_file + need_restart=1 + fi + chmod 644 $ini_file +done + + +# Check for /etc/php/7.0/conf.d/ directory. +# +if [ ! -d "$PHP70CONFD" ]; then + cp_echo "CN: Creating configuration directory $PHP70CONFD" + mkdir -p $PHP70CONFD/ +fi + +# Brisanje obsolete datoteke mysql.ini u $PHP70CONFD +# +if [ -f "$PHP70CONFD/mysql.ini" ]; then + # just to make sure mysql is included in _new-style_ configuration + if [ -f "$PHP70MODADIR/mysql.ini" ]; then + cp_echo "CN: Removing obsolete $PHP70CONFD/mysql.ini" + rm -f $PHP70CONFD/mysql.ini + else + cp_echo "CN: WARNING: Obsolete $PHP70CONFD/mysql.ini present, and no $PHP70MODADIR/mysql.ini!" + fi +fi + +# Check if PHP7 extensions are enabled. +# +for php70ext in $EXTENSIONS; do + + php70ext_re="^[[:space:]]*extension[[:space:]]*=[[:space:]]*$php70ext\.so" + + # Remove extension entry from /etc/php/7.0/(apache2|cli).ini + # configuration files. + for SAPI in apache2 cli; do + + ini_file="$PHP70DIR/$SAPI/php.ini" + + if [ -f "$ini_file" ]; then + + if egrep -q "$php70ext_re" "$ini_file"; then + cp_echo "CN: Removing $php70ext extension from file $ini_file" + fi + + cp_check_and_sed "$php70ext_re" \ + "/$php70ext_re/d" \ + "$ini_file" && need_restart=1 || true + fi + done + + # Check extension configuration in /etc/php/7.0/conf.d/ directory. + if [ ! -f "$PHP70CONFD/$php70ext.ini" ]; then + + cp_echo "CN: Creating configuration file $PHP70CONFD/$php70ext.ini" + + php5ext_up=`echo $php70ext | tr [:lower:] [:upper:] | sed 's/Y/y/'` + INITMP=`mktemp $PHP70CONFD/$php70ext.ini.tmp.XXXXXX` + + cp_echo "CN: Adding $php70ext extension to file $PHP70CONFD/$php70ext.ini" + + printf "# configuration for php %s module\nextension=%s.so\n" "${php70ext_up}" "${php5ext}" >> "$INITMP" + cp_mv "$INITMP" "$PHP70CONFD/$php70ext.ini" + + need_restart=1 + else + + if ! grep -q "$php70ext_re" "$PHP70CONFD/$php70ext.ini"; then + + cp_echo "CN: Adding $php70ext extension to file $PHP70CONFD/$php70ext.ini" + + INITMP=`mktemp $PHP70CONFD/$php70ext.ini.tmp.XXXXXX` + cat "$PHP70CONFD/$php70ext.ini" > "$INITMP" + echo "extension=$php70ext.so" >> "$INITMP" + cp_mv "$INITMP" "$PHP70CONFD/$php70ext.ini" + + need_restart=1 + fi + fi + chmod 644 $PHP70CONFD/$php70ext.ini +done + + +# Enable some PHP7 tweaks for Apache2 web server (/etc/php/7.0/apache2/php.ini). +# +# * 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 + + if [ ! -d "$PHP70DIR/$SAPI" ]; then + continue + fi + + ini_file="$PHP70DIR/$SAPI/php.ini" + db_get php7.0-cn/${SAPI} || true + if [ "$RET" = "true" ]; then + + cp_echo "CN: Checking and enabling some specific parameters in file $ini_file" + + phplimit="$(phpmemlimit)M" + + if [ -f "$ini_file" ]; then + + cp_check_and_sed "^[[:space:]]*upload_max_filesize[[:space:]]*=" \ + 's/^[[:space:]]*upload_max_filesize[[:space:]]*=.*/upload_max_filesize = 256M/' \ + "$ini_file" && need_restart=1 || true + + cp_check_and_sed "^[[:space:]]*post_max_size[[:space:]]*=" \ + "s/^[[:space:]]*post_max_size[[:space:]]*=.*/post_max_size = ${phplimit}/" \ + "$ini_file" && need_restart=1 || true + + 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` + if [ -f "$ini_file" ]; then + cat $ini_file > $ini_file_tmp + fi + + if ! egrep -q "^[[:space:]]*upload_max_filesize[[:space:]]*=" $ini_file_tmp; then + echo "upload_max_filesize = 256M" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*post_max_size[[:space:]]*=" $ini_file_tmp; then + echo "post_max_size = ${phplimit}" >> "$ini_file_tmp" + need_restart=1 + fi + if ! egrep -q "^[[:space:]]*memory_limit[[:space:]]*=" $ini_file_tmp; then + 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" + + if [ -e "$ini_file_tmp" ]; then + rm -f "$ini_file_tmp" + fi + fi + + # Validate php.ini values. + if [ -f "$ini_file" ]; then + php70_inivalues="$(phpinivalidate "$ini_file")" + if [ -n "$php70_inivalues" ]; then + db_fset php7.0-cn/inivalues seen false + db_title php7.0-cn - konfiguracija za $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/inivalues php70_sapi $(echo ${SAPI} | sed 's/a/A/;s/cli/CLI/') + db_subst php7.0-cn/inivalues ini_file "$ini_file" + db_capb escape + db_subst php7.0-cn/inivalues php70_inivalues "$(echo -n "$php70_inivalues" | debconf-escape -e)" + db_input critical php7.0-cn/inivalues || true + db_go || true + fi + fi +done + + +# Compare active PHP7 extensions with PHP5 ones, if PHP5 configuration still exists. +# +if [ -d "${PHP5DIR}" ] && [ -f "${PHP5DIR}/apache2/php.ini" ]; then + + phpext_re='^[[:space:]]*extension[[:space:]]*=[[:space:]]*["]{0,1}(.*)\.so["]{0,1}' + + # Get all active PHP5 extensions. + php5_ext="$(find ${PHP5DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + + # Get all active PHP7 extensions. + php70_ext="" + if [ -d "${PHP5DIR}" ]; then + php70_ext="$(find ${PHP70DIR} -type f -name *.ini | + egrep "\/(conf\.d|apache2|cli)\/" | + xargs sed -rn 's/'$phpext_re'/\1/Ip')" || true + fi + + # Compare PHP7 <-> PHP5 extensions. + php70_ext_mis="" + for ext in $php5_ext; do + if [ "$(echo $php70_ext | egrep $ext)" = "" ]; then + php70_ext_mis="\n${ext}${php70_ext_mis}" + fi + done + + # Some PHP7 extensions are not active. + if [ -n "$php70_ext_mis" ]; then + db_fset php7.0-cn/extensions seen false + db_title php7.0-cn - konfiguracija + db_capb escape + db_subst php7.0-cn/extensions php70_extensions "${php70_ext_mis#*\n}" + db_input critical php7.0-cn/extensions || true + db_go || true + fi +fi + + +db_stop || true + + +# Restart Apache2 web server if needed. +# +if [ $need_restart -eq 1 ]; then + + # Check Apache2 web server configuration. + if apache2ctl configtest 2>/dev/null; then + invoke-rc.d apache2 force-reload || true + else + # Something is broken. + cp_echo "CN: Your Apache2 configuration is broken." + cp_echo "CN: Please, check the service after the installation finishes!" + fi +fi + + +# Mail root +# +cp_mail "$PKG" + +#DEBHELPER# + +exit 0 diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..b7ec504 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +#DEBHELPER# + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..cbe925d --- /dev/null +++ b/debian/rules @@ -0,0 +1,3 @@ +#!/usr/bin/make -f +%: + dh $@ diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..1849ca4 --- /dev/null +++ b/debian/templates @@ -0,0 +1,84 @@ +Template: php7.0-cn/apache2 +Type: boolean +_Description: Zelite li aktivirati preporucene PHP7 postavke za Apache2? + Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da su sljedece postavke aktivne: + . + 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: php7.0-cn/cli +Type: boolean +_Description: Zelite li aktivirati preporucene PHP7 postavke za CLI? + Provjerom trenutne PHP7 konfiguracije za CLI (PHP interpreter + za komandnu liniju, konfiguracijska datoteka ${ini_file}), + ustanovljeno je da su sljedece postavke aktivne: + . + 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: php7.0-cn/inivalues +Type: note +_Description: Postavke unutar PHP7 konfiguracije nisu ispravne + Provjerom trenutne PHP7 konfiguracije za ${php70_sapi} (konfiguracijska + datoteka ${ini_file}), ustanovljeno je da sljedece postavke nisu ispravne: + . + ${php70_inivalues} + . + Vrijednosti za navedene postavke ne smiju zavrsavati sa 'B'. Dozvoljene + oznake su 'K' (kilo), 'M' (mega) i 'G' (giga), npr. 16K, 32M, 1G. U protivnom, + kao mjerna jedinica koristit ce se 'byte'. Molimo, svakako provjerite postavke + unutar navedene datoteke kako bi aplikacije (kao sto je Squirrelmail) mogle + normalno funkcionirati. + +Template: php7.0-cn/extensions +Type: note +_Description: Neki dodaci (extensions) za PHP7 nisu ukljuceni + Iako je PHP5 uklonjen sa sustava, ostala je njegova konfiguracija. Usporedbom + trenutnih PHP5 i PHP7 konfiguracijskih datoteka, ustanovljeno je da sljedeci + PHP7 dodaci (extensions) nisu ukljuceni, iako su ukljuceni za PHP5: + . + ${php70_extensions} + . + Kako su neki od dodataka ukljuceni u PHP5 konfiguraciji, postoji mogucnost da + pojedine aplikacije zahtjevaju odgovarajuce dodatke za PHP7. Primjerice, ako + je u PHP5 konfiguraciji bio ukljucen dodatak za LDAP (php5-ldap), tada je + u PHP7 konfiguraciji potrebno ukljuciti PHP7 dodatak za LDAP (php7.0-ldap). Molimo, + svakako provjerite PHP7 postavke kako bi PHP aplikacije koje se koriste na + posluzitelju mogle normalno funkcionirati. + . + Ako za neke od navedenih dodataka ne postoji odgovarajuca inacica za PHP7 + ili ste sigurni da neke od navedenih dodatka vise ne trebate, slobodno + ignorirajte ovu poruku. + +Template: php7.0-cn/userdir +Type: note +_Description: PHP7 nije omogucen za neke direktorije + Provjerom trenutne PHP7 konfiguracije za Apache2 (konfiguracijska + datoteka ${php70_conf}), ustanovljeno je da PHP7 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-php7.0 onemogucuje PHP7 za + ~/public_html direktorije ako je omogucen mod_userdir modul za Apache2.