Seiden Group
Modern Development & Open Source for IBM i
  • Link to LinkedIn
  • Link to Mail
  • Home
  • Seiden PHP+
    • Seiden PHP+
    • Install & Learn
    • SmartSupport
    • PHP Migrations & Upgrades
    • Success Stories
    • Free PHP Assessment
    • Documentation
    • What’s New (Changelog)
  • IBM i Services
    • Development
    • Training & Mentoring
    • Open Source Setup & Upgrades
    • SSL/TLS Install & Learn
    • Performance
  • Support
    • Open Source & PHP
    • VS Code for i
    • Developer Support
    • Support Success Stories
  • VS Code for i
    • Support
    • Training
    • Code for i Resource Guide
    • Getting Started Videos
    • Code for IBM i Fridays
  • Free Stuff
    • IBM i Strategy & Tips
    • PHP Upgrade Assessment
    • CNX Valence Assessment
    • VS Code for IBM i Resources
    • Code for IBM i Fridays
    • QCachegrind Download
    • PHP Toolkit for IBM i Resources
    • Qshell on i Library
  • Blog
  • About
    • About Our Team
    • About Alan Seiden
    • Speakers & Sessions
    • In the News
  • Contact
  • 201.447.2437
  • Search
  • Menu Menu

Seiden Group Blog

PHP_FCGI_MAX_REQUESTS Solves Job Cleanup Issues

August 11, 2023/1 Comment/in PHP /by Alan Seiden

One of PHP’s strengths is that each PHP job or process cleans itself up after every request. This makes PHP very reliable and stable.

On occasion, though, an extension may have a bug that leaks memory or causes other problems over time. If that happens, PHP’s FastCGI settings provide a solution.

PHP_FCGI_MAX_REQUESTS

A setting in fastcgi.conf, PHP_FCGI_MAX_REQUESTS determines how many requests a PHP job should handle before ending and restarting. The default of zero (0) means each job will handle an unlimited number of requests. When PHP_FCGI_MAX_REQUESTS is greater than zero, the job will restart after it receives that number of requests, cleaning up any issues that may have accumulated over time, such as memory leaks in extensions.

Example A:
SetEnv="PHP_FCGI_MAX_REQUESTS=0" (unlimited number of requests for the job)
Example B:
SetEnv="PHP_FCGI_MAX_REQUESTS=100" (restart job after 100 requests to that job)

Guidelines for Using PHP_FCGI_MAX_REQUESTS

Here is our advice on when to use PHP_FCGI_MAX_REQUESTS and what value to use:

  • If your problem is solved by restarting the web server, it’s likely that PHP_FCGI_MAX_REQUESTS will help, but in a smoother way. It basically causes a slow-motion, undetectable rolling restart of the PHP jobs.
  • Choose a number that is high enough not to slow down your site, but low enough to restart a given job before any symptoms of the bug arise. A good starting number to try is 100. A lower number may be appropriate for a site with low volume; higher for high volume.

For more information on PHP FastCGI settings, see “Optimize Your IBM i Web Application Using FastCGI.”

Tags: FastCGI, IBMi, PHP
Share this entry
  • Share on Facebook
  • Share on X
  • Share on Pinterest
  • Share on LinkedIn
  • Share on Tumblr
  • Share on Reddit
  • Share by Mail
https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png 0 0 Alan Seiden https://www.seidengroup.com/wp-content/uploads/2017/03/SeidenLogo-180.png Alan Seiden2023-08-11 15:38:512025-06-26 17:25:54PHP_FCGI_MAX_REQUESTS Solves Job Cleanup Issues
Alan Seiden

About Alan Seiden

Alan works to preserve your investment in IBM enterprise systems by designing and implementing modernization strategies that leverage your existing business logic.

With a passion ...Read More

1 reply
  1. BENNY KURIAN
    BENNY KURIAN says:
    September 8, 2023 at 9:26 pm

    Thank you

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

SUBSCRIBE
Open Thinking
Monthly IBM i Strategy & Tips
  • This field is for validation purposes and should be left unchanged.

IBM i Development

  • RPG, COBOL, SQL, Node,
    PHP, Python, Valance, etc.
  • Modernization. Integration.
  • Web and API Solutions
  • Legacy Maintenance
    ...
LET'S GET IT DONE!

Recent Posts

  • PHP Security Updates for November 2026
  • Still Running Net.Data on IBM i? We Can Help
  • Mitigating the eMudhra Intermediate CA Compromise with IBM i
  • Critical php2shell Security Update Available in Seiden PHP+ Server
  • Moving to IBM i 7.6? An SDA Alternative with VS Code and IBM Bob
  • What’s New with Mapepire Database Connector for IBM i
  • Do You Need IBM i Observability?
  • PHP 8.6 is Coming Soon to IBM i
  • Safer npm installation is on the way for Node.js (and all JavaScript)
  • Protecting IBM i and Web Applications from Modern Threats

SEIDEN GROUP: Modern Development & Open Source for IBM i

Home   |   Seiden PHP+   |   IBM i Services  |   Support   |   VS Code for i   |   Free Stuff   |   Blog  |   Privacy Policy  |   Contact         201.447.2437

© 2026 Seiden Group, LLC
  • Link to LinkedIn
  • Link to Mail
Link to: IBM i API Examples Using RPG, Node.js, PHP, and Python Link to: IBM i API Examples Using RPG, Node.js, PHP, and Python IBM i API Examples Using RPG, Node.js, PHP, and Python Link to: Using SSH Keys with VS Code for IBM i Link to: Using SSH Keys with VS Code for IBM i Using SSH Keys with VS Code for IBM i
Scroll to top Scroll to top Scroll to top