How to edit PHP settings on a WordPress website

This article will tell you how to change PHP settings like workers, RAM, OPCache and more.
In this article

To edit the settings of one website, click on the Edit Website button (pencil).

Here you’ll find several tabs with options. We’ll have a look at each tab and option.

PHP Process Manager tab

  • PHP Version: This allows you to change the PHP version for this specific website. You can find all the information about how to change the PHP version here.
  • PHP Process Manager: This setting controls how the PHP Process Manager behaves for this particular website. The options are:
    • ServPress Optimized: Our recommended default for a simple WordPress installation.
    • On demand: PHP workers will be created and destroyed based on the website’s demand, up to the maximum. This is the recommended option for websites with inconsistent traffic or small websites with cache and not too many dynamic content. Since this is option destroys the PHP workers after some time, it’s the best option for servers that are on a RAM budget.
    • Static: PHP workers will be all created before handling any request, and will always stay alive. This is the recommended option for websites with consistent traffic, but you will also need enough RAM to serve these websites since PHP workers are never freed up with this setting.
    • Dynamic: The balanced option, half of the PHP workers will be static, and half will be on demand.

If you aren’t using the “ServPress Optimized” setting, more settings will appear for you to fine-tune how your website behaves:

  • Max execution time: The time one worker is allowed to be processing a single request, in seconds. If exceeded, the request will be aborted and the PHP worker will be free to work on another request. If you have any long running task, consider raising this value.
  • Max RAM available per worker: The amount of RAM in MB that a single worker can use to satisfy requests. Depending on what plugins you are using, you might need to raise this value. For instance, Elementor suggests that you use 768MB of RAM per worker for best performance.
  • PHP workers: The amount of workers allowed to be used for this website. This will have a different meaning depending on your PHP Process Manager setting:
    • On Demand: Limit of workers that can be created, so your website can scale from 0 workers to the number you chose
    • Static: this is the number of workers that will be created instantly to serve your website. The number of workers will stay static (hence the name).
    • Dynamic: Half of the number you put here will be created as Static workers, and the other half will be dynamic. If you choose an odd number, the static part will always be the bigger “half”. Example: 3 workers would be 2 static and 1 on demand, while 5 workers would be 3 static and 2 on demand, and so on.
  • Max requests per worker: The max number of requests a worker will handle before being refreshed. After a worker has served this number of requests, it’ll replaced by a fresh worker. This helps avoiding memory leaks and stalled memory values. We recommend a value of 500 for most websites, but if you don’t want this to happen (you trust there’s no memory leaks on your WordPress install), you can put 0 on this field for maximum performance.
  • PHP worker lifespan: This is how many seconds have to pass before the system destroys them for inactivity. The lower the number, the faster the system will destroy them after they’ve fulfilled a request. Note that this won’t ever interrupt an on-going request. This option only applies for the “On Demand” type of PHP worker.

OPCache tab

This tab allows you to configure how OPCache works in this particular website.

  • ServPress Optimized: OPCache is enabled and we apply our recommended settings for a small WordPress installation.
  • OPCache Enabled: OPCache is enabled, but you are able to customize every single relevant option for OPCache. You can read more about those options below.
  • OPCache Disabled: Completely disable OPCache. We don’t recommend this, only for testing purposes.

If you have the OPCache Enabled option, you can fine tune the OPCache behaviour even further. The options you are able to change are:

  • RAM dedicated to OPCache: The RAM in MB that all PHP workers will share as OPCache.
  • RAM dedicated to strings: Amount of memory that OPCache can use to store strings. This allows OPCache to have a list of strings in memory, so every time a string of text is repeated, the string is only stored once, increasing performance and reducing total memory usage.
  • # of accelerated files: How many .php files can OPCache put into memory. WordPress 6.1.1, without any plugins and the default theme, has a total of 939 PHP files, with almost half a million lines of code. Since you are probably going to install plugins and themes, we recommend this amount of files to be higher.
  • % of memory that can be wasted: When a PHP file changes, the file has to be recompiled and a new section of memory is used. The compiled version of the old file is then deleted, but it leaves a “hole” in memory, that can’t be reused efficiently. This is called fragmentation. This setting indicates the % of memory that can be left empty as “holes in memory” before OPCache has to reorder the memory to be able to fit more data in the same space.
  • File revalidation interval: This setting indicates how frequently you want OPCache to check if PHP files have changed. When you are testing or developing, you want this value to be low, so file changes are reflected immediately. When your site is in production, we recommend this value to be between 120 and 180 seconds, although it can be more if your site doesn’t change that often.

Debug

This tab is simple: it allows you to toggle the WordPress debug on and off. You don’t need to click on Save to make the change, it’s applied immediately.

Integrations

This tab allows you to toggle the integrations ServPress has in place with different plugins with your website. The available integrations are:

Do you have more questions?

Join our community today and feel free to ask about ServPress.

We’ll do our best to help you out.

WordPress Cookie Notice by Real Cookie Banner