Bug#639268: [PATCH] Handle .phar (and .bz2|.gz|.zip) with PHP

2014-03-17 Thread Christian Weiske
Configure apache to handle .phar, .phar.bz2, phar.gz and .phar.zip
files with the PHP module.

Resolves: #639268
---
 INSTALL| 6 +++---
 debian/php5-cgi.conf   | 4 ++--
 debian/php5.conf   | 4 ++--
 debian/php5filter.conf | 4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git INSTALL INSTALL
index 141e4f8..2d2abb7 100644
--- INSTALL
+++ INSTALL
@@ -462,9 +462,9 @@ LoadModule php5_module modules/libphp5.so
 SetHandler application/x-httpd-php
 /FilesMatch
Or,  if we wanted to
allow .php, .php2, .php3, .php4, .php5, .php6,
-   and  .phtml files to be executed as PHP, but nothing else, we'd
use
-   this:
-FilesMatch \.ph(p[2-6]?|tml)$
+   .phtml,  .phar,  .phar.bz2,  phar.gz  and  .phar.zip  files
to  be
+   executed as PHP, but nothing else, we'd use this:
+FilesMatch \.ph(ar(|\.bz2|\.gz|\.zip)|p[2-6]?|tml)$
 SetHandler application/x-httpd-php
 /FilesMatch
And  to  allow  .phps files to be handled by the php source
filter, diff --git debian/php5-cgi.conf debian/php5-cgi.conf
index 2a18b14..32d3bfa 100644
--- debian/php5-cgi.conf
+++ debian/php5-cgi.conf
@@ -5,7 +5,7 @@
 # application/x-httpd-php3   php3
 # application/x-httpd-php4   php4
 # application/x-httpd-php5   php
-FilesMatch .+\.ph(p[345]?|t|tml)$
+FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml)$
 SetHandler application/x-httpd-php
 /FilesMatch
 # application/x-httpd-php-source phps
@@ -18,7 +18,7 @@
 Deny from all
 /FilesMatch
 # Deny access to files without filename (e.g. '.php')
-FilesMatch ^\.ph(p[345]?|t|tml|ps)$
+FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
 Order Deny,Allow
 Deny from all
 /FilesMatch
diff --git debian/php5.conf debian/php5.conf
index 2e9772f..c70347f 100644
--- debian/php5.conf
+++ debian/php5.conf
@@ -1,4 +1,4 @@
-FilesMatch .+\.ph(p[345]?|t|tml)$
+FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml)$
 SetHandler application/x-httpd-php
 /FilesMatch
 FilesMatch .+\.phps$
@@ -10,7 +10,7 @@
 Deny from all
 /FilesMatch
 # Deny access to files without filename (e.g. '.php')
-FilesMatch ^\.ph(p[345]?|t|tml|ps)$
+FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
 Order Deny,Allow
 Deny from all
 /FilesMatch
diff --git debian/php5filter.conf debian/php5filter.conf
index 50c88b4..ce3f163 100644
--- debian/php5filter.conf
+++ debian/php5filter.conf
@@ -1,9 +1,9 @@
-FilesMatch .+\.ph(p3?|tml)$
+FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p3?|tml)$
 SetInputFilter PHP
 SetOutputFilter PHP
 /FilesMatch
 # Deny access to files without filename (e.g. '.php')
-FilesMatch ^\.ph(p[345]?|t|tml|ps)$
+FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
 Order Deny,Allow
 Deny from all
 /FilesMatch
-- 
1.8.3.2



signature.asc
Description: PGP signature


Bug#639268: [php-maint] Bug#639268: [PATCH] Handle .phar (and .bz2|.gz|.zip) with PHP

2014-03-17 Thread Thijs Kinkhorst
Hi,

Thanks, but this does not really answer my question?


Thijs

On Mon, March 17, 2014 17:48, Christian Weiske wrote:
 Configure apache to handle .phar, .phar.bz2, phar.gz and .phar.zip
 files with the PHP module.

 Resolves: #639268
 ---
  INSTALL| 6 +++---
  debian/php5-cgi.conf   | 4 ++--
  debian/php5.conf   | 4 ++--
  debian/php5filter.conf | 4 ++--
  4 files changed, 9 insertions(+), 9 deletions(-)

 diff --git INSTALL INSTALL
 index 141e4f8..2d2abb7 100644
 --- INSTALL
 +++ INSTALL
 @@ -462,9 +462,9 @@ LoadModule php5_module modules/libphp5.so
  SetHandler application/x-httpd-php
  /FilesMatch
 Or,  if we wanted to
 allow .php, .php2, .php3, .php4, .php5, .php6,
 -   and  .phtml files to be executed as PHP, but nothing else, we'd
 use
 -   this:
 -FilesMatch \.ph(p[2-6]?|tml)$
 +   .phtml,  .phar,  .phar.bz2,  phar.gz  and  .phar.zip  files
 to  be
 +   executed as PHP, but nothing else, we'd use this:
 +FilesMatch \.ph(ar(|\.bz2|\.gz|\.zip)|p[2-6]?|tml)$
  SetHandler application/x-httpd-php
  /FilesMatch
 And  to  allow  .phps files to be handled by the php source
 filter, diff --git debian/php5-cgi.conf debian/php5-cgi.conf
 index 2a18b14..32d3bfa 100644
 --- debian/php5-cgi.conf
 +++ debian/php5-cgi.conf
 @@ -5,7 +5,7 @@
  # application/x-httpd-php3   php3
  # application/x-httpd-php4   php4
  # application/x-httpd-php5   php
 -FilesMatch .+\.ph(p[345]?|t|tml)$
 +FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml)$
  SetHandler application/x-httpd-php
  /FilesMatch
  # application/x-httpd-php-source phps
 @@ -18,7 +18,7 @@
  Deny from all
  /FilesMatch
  # Deny access to files without filename (e.g. '.php')
 -FilesMatch ^\.ph(p[345]?|t|tml|ps)$
 +FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
  Order Deny,Allow
  Deny from all
  /FilesMatch
 diff --git debian/php5.conf debian/php5.conf
 index 2e9772f..c70347f 100644
 --- debian/php5.conf
 +++ debian/php5.conf
 @@ -1,4 +1,4 @@
 -FilesMatch .+\.ph(p[345]?|t|tml)$
 +FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml)$
  SetHandler application/x-httpd-php
  /FilesMatch
  FilesMatch .+\.phps$
 @@ -10,7 +10,7 @@
  Deny from all
  /FilesMatch
  # Deny access to files without filename (e.g. '.php')
 -FilesMatch ^\.ph(p[345]?|t|tml|ps)$
 +FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
  Order Deny,Allow
  Deny from all
  /FilesMatch
 diff --git debian/php5filter.conf debian/php5filter.conf
 index 50c88b4..ce3f163 100644
 --- debian/php5filter.conf
 +++ debian/php5filter.conf
 @@ -1,9 +1,9 @@
 -FilesMatch .+\.ph(p3?|tml)$
 +FilesMatch .+\.ph(ar(|\.bz2|\.gz|\.zip)|p3?|tml)$
  SetInputFilter PHP
  SetOutputFilter PHP
  /FilesMatch
  # Deny access to files without filename (e.g. '.php')
 -FilesMatch ^\.ph(p[345]?|t|tml|ps)$
 +FilesMatch ^\.ph(ar(|\.bz2|\.gz|\.zip)|p[345]?|t|tml|ps)$
  Order Deny,Allow
  Deny from all
  /FilesMatch
 --
 1.8.3.2

 ___
 pkg-php-maint mailing list
 pkg-php-ma...@lists.alioth.debian.org
 http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-php-maint


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#639268: [php-maint] Bug#639268: [PATCH] Handle .phar (and .bz2|.gz|.zip) with PHP

2014-03-17 Thread Christian Weiske
Hello Thijs,


 I'm missing why we would want Apache to handle the phar file
 directly. If it's an archive, don't you want to download it instead
 of execute it in the web server context?
 Thanks, but this does not really answer my question?

I didn't see your question until I read the bug, sorry.

PHAR archives can be used to distribute full web applications with all
dependencies included, so that you only have to put it in your web
server's document root and access it via your browser.

Specifically to support this, phar has a feature called web index
file in the phar stub[1]. It gets called whenever the phar is executed
through a HTTP request.

So it makes sense to let PHP handle phar files (and their compressed
versions) directly, without extracting them.
More information about phar can be found on [2].


[1] http://www.php.net/manual/en/phar.createdefaultstub.php
[2] http://www.php.net/manual/en/intro.phar.php

-- 
Regards/Mit freundlichen Grüßen
Christian Weiske

-=≡ Geeking around in the name of science since 1982 ≡=-


signature.asc
Description: PGP signature