Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {code}
- export PHP_FCGI_MAX_REQUESTS = 200
- export PHP_FCGI_MAX_CHILDREN = 1
- php -b localhost:9000 &
- php -b localhost:9001 &
- php -b localhost:9002 &
- php -b localhost:9003 &
- php -b localhost:9004 &
- {code}
- - We now have 5 php instances running, each will last for 200 requests before dying (to prevent memory leaks), and each instance is on its own port.
- This is how mod_fastcgi and mod_fcgid (to my knowledge) spawn php instances.
- This DOES NOT SUPPORT APC.
- {code}
- export PHP_FCGI_MAX_REQUESTS = 1000
- export PHP_FCGI_MAX_CHILDREN = 5
- php -b localhost:9000 &
- {code}
- - We now have 6 php instances running, 1 master and 5 child processes. Each will last for 200 requests before dying (to prevent memory leaks), but only the master process has a port, it handles sending requests to the children that actually handle the requests.
- Because of this master/child setup, APC can work (the master keeps a cache, that all the children can share)
- This is how php-fpm and lighttpd's spawn-fcgid work. (usually used with alternative webservers.)
- While both of these code blocks will work to start a php fastcgi server without any tools like php-fpm or such, they are NOT for use in production. You need a process manager that will automatically restart PHP when it ends (when it hits the max request limit.)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement