[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] [pecl-php-uploadprogress] master: Indicate support for PHP-FPM and update examples
From:       Ben Ramsey <noreply () php ! net>
Date:       2021-09-29 15:30:43
Message-ID: VzHaVMyEIGuegY27K42XdjHNUb8p578If00cL9J4qs () main ! php ! net
[Download RAW message or body]

Author: Ben Ramsey (ramsey)
Date: 2021-09-29T10:30:43-05:00

Commit: https://github.com/php/pecl-php-uploadprogress/commit/a88b5726feb2cba0734ef5a488b6e47eb6ec1992
 Raw diff: https://github.com/php/pecl-php-uploadprogress/commit/a88b5726feb2cba0734ef5a488b6e47eb6ec1992.diff


Indicate support for PHP-FPM and update examples

Changed paths:
  A  examples/nginx.conf
  M  README.md
  M  examples/.docker/Dockerfile
  M  examples/README.md
  M  examples/docker-compose.yml
  M  package.xml


Diff:

diff --git a/README.md b/README.md
index 56392d4..62e4f5d 100644
--- a/README.md
+++ b/README.md
@@ -6,9 +6,10 @@ file as it is being uploaded.
 
 ## Requirements
 
-The uploadprogress extension works on PHP 7.2+ and PHP 8. It requires the
-use of the [Apache HTTP Server][] with [mod_php][]. Other web servers and
-[PHP-FPM][] are not yet supported.
+The uploadprogress extension works on PHP 7.2+ and PHP 8. It works with
+[Apache HTTP Server][] using [mod_php][], as well as [Apache HTTP Server][],
+[nginx][], and [Caddy][] through [PHP-FPM][]. It might work on other web
+servers; let us know where you're using it.
 
 ## Example
 
@@ -202,3 +203,5 @@ The extension will also add its own block to the output of \
`phpinfo();`.  [mod_php]: https://www.php.net/manual/en/install.unix.apache2.php
 [php-fpm]: https://www.php.net/fpm
 [examples]: ./examples
+[nginx]: https://nginx.org
+[caddy]: https://caddyserver.com
diff --git a/examples/.docker/Dockerfile b/examples/.docker/Dockerfile
index 6b886cf..cb87a35 100644
--- a/examples/.docker/Dockerfile
+++ b/examples/.docker/Dockerfile
@@ -1,5 +1,5 @@
 ARG php_version
-FROM php:${php_version}-apache
+FROM php:${php_version}-fpm
 
 ARG uploadprogress_version
 
diff --git a/examples/README.md b/examples/README.md
index fe85822..5a1b4e4 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -2,13 +2,12 @@
 
 To run this example, you will need:
 
-* [Apache httpd][] with [mod_php][] (other web servers and [PHP-FPM][] are not
-  yet supported)
+* [Apache HTTP Server][] using [mod_php][], or [PHP-FPM][] used with
+  [Apache HTTP Server][], [nginx][], or [Caddy][].
 * PHP >= 7.2 with the [fileinfo][] extension
 
 The easiest way to run this example is by using [Docker][] with the provided
-`docker-compose.yml` file (which includes all the requirements), though Docker
-is not required.
+`docker-compose.yml` file (which includes all the requirements).
 
 ## Using docker-compose
 
@@ -30,7 +29,9 @@ enter `docker-compose rm` to remove the container that was created.
 
 
 [docker]: https://www.docker.com
-[apache httpd]: https://httpd.apache.org
+[Apache HTTP Server]: https://httpd.apache.org
 [mod_php]: https://www.php.net/manual/en/install.unix.apache2.php
 [php-fpm]: https://www.php.net/fpm
 [fileinfo]: https://www.php.net/fileinfo
+[nginx]: https://nginx.org
+[caddy]: https://caddyserver.com
diff --git a/examples/docker-compose.yml b/examples/docker-compose.yml
index 37869a5..fcec5bb 100644
--- a/examples/docker-compose.yml
+++ b/examples/docker-compose.yml
@@ -2,16 +2,25 @@ version: "3.7"
 
 services:
 
-  webapp:
-    container_name: uploadprogress-example
-    image: uploadprogress-example
+  nginx:
+    container_name: uploadprogress-web
+    image: nginx:latest
+    ports:
+      - "8080:80"
+    volumes:
+      - "$PWD/nginx.conf:/etc/nginx/conf.d/default.conf"
+      - ".:/var/www/html"
+    depends_on:
+      - php-fpm
+
+  php-fpm:
+    container_name: uploadprogress-php-fpm
+    image: uploadprogress-example-php-fpm
     build:
       context: ./.docker
       args:
         php_version: 8.0
         uploadprogress_version: 2.0.1
-    ports:
-      - "8080:80"
     volumes:
       - "./.tmp:/tmp"
       - ".:/var/www/html"
diff --git a/examples/nginx.conf b/examples/nginx.conf
new file mode 100644
index 0000000..bbb9967
--- /dev/null
+++ b/examples/nginx.conf
@@ -0,0 +1,25 @@
+server {
+    listen 80;
+    root /var/www/html;
+    index index.html index.php;
+    client_max_body_size 13G;
+
+    location / {
+        try_files $uri $uri/ /index.php?$args;
+    }
+
+    location ~ [^/]\.php(/|$) {
+        fastcgi_split_path_info ^(.+?\.php)(/.*)$;
+        if (!-f $document_root$fastcgi_script_name) {
+            return 404;
+        }
+
+        include fastcgi_params;
+        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+        fastcgi_param PATH_INFO $fastcgi_path_info;
+        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
+
+        fastcgi_pass php-fpm:9000;
+        fastcgi_index index.php;
+    }
+}
\ No newline at end of file
diff --git a/package.xml b/package.xml
index c612563..048a5f9 100644
--- a/package.xml
+++ b/package.xml
@@ -11,7 +11,7 @@
     <description>
         A PHP extension to track progress of a file upload, including details on the \
speed of the upload, estimated time remaining, and access to the contents of the file \
as it is being uploaded.  
-        The uploadprogress extension works on PHP 7.2+ and PHP 8. It requires the \
use of the Apache HTTP Server with mod_php. Other web servers and PHP-FPM are not yet \
supported. +        The uploadprogress extension works on PHP 7.2+ and PHP 8. It \
works with Apache HTTP Server using mod_php, as well as Apache HTTP Server, nginx, \
and Caddy through PHP-FPM. It might work on other web servers; let us know where \
you're using it.  
         See https://github.com/php/pecl-php-uploadprogress for documentation and \
examples.  </description>
@@ -65,6 +65,7 @@
                 <file name="docker-compose.yml" role="doc"/>
                 <file name="handle-upload.php" role="doc"/>
                 <file name="index.html" role="doc"/>
+                <file name="nginx.conf" role="doc"/>
             </dir>
             <dir name="tests">
                 <dir name="mocks">

-- 
PECL CVS Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic