PHPackages                             jeremiah-shaulov/php-web-node - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jeremiah-shaulov/php-web-node

ActiveLibrary[Database &amp; ORM](/categories/database)

jeremiah-shaulov/php-web-node
=============================

PHP-FPM implementation that allows to preserve resources (global variables) between requests, so database connections pool is possible

v1.0.1(5y ago)022MITPHPPHP &gt;=7.4

Since Jul 19Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jeremiah-shaulov/php-web-node)[ Packagist](https://packagist.org/packages/jeremiah-shaulov/php-web-node)[ Docs](https://github.com/jeremiah-shaulov/php-web-node)[ RSS](/packages/jeremiah-shaulov-php-web-node/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (3)Used By (0)

php-web-node
============

[](#php-web-node)

PhpWebNode is PHP-FPM implementation written in PHP that allows to preserve resources (global variables) between requests, so database connections pool is possible. Applications based on this library can be used instead of PHP-FPM. PhpWebNode acts like FastCGI server, to which web server (like Apache) will send HTTP requests. It will spawn child processes that will handle the requests synchronously. Several (up to 'pm.max\_children') children will run in parallel, and each child will sequentially process incoming requests, preserving global (and static) variables.

How fast is php-web-node
------------------------

[](#how-fast-is-php-web-node)

It's written in PHP, so i expected that my application will slow down a little comparing to PHP-FPM. I was surprised that the application became a little faster. Actually php-web-node removes need to reinitialize resources, and reconnect to database.

What's supported
----------------

[](#whats-supported)

Most of PHP features that i know, except `$_SESSION` are supported. Most existing PHP scripts will work as with PHP-FPM, except principal distinction explained below, in "Step 3. Update PHP scripts".

PhpWebNode implements complete FastCGI protocol, including connection multiplexing, however as far as i know, currently none of popular web servers support this feature. [More info](https://stackoverflow.com/questions/25556168/nginx-fastcgi-uses-management-records-if-not-then-what).

Installation
------------

[](#installation)

Create a directory for your application, `cd` to it, and issue:

```
composer require jeremiah-shaulov/php-web-node

```

How to use php-web-node
-----------------------

[](#how-to-use-php-web-node)

To use php-web-node we need to pass 3 steps:

1. Create master application
2. Set up web server to use our application
3. Update PHP scripts that we want to serve with php-web-node

### Step 1. Create master application

[](#step-1-create-master-application)

We need a master application that will work as PHP-FPM service. Let's call it server.php:

```
