You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ff1fda2
Browse filesBrowse the repository at this point in the historyBrowse files
|[opcache](https://www.php.net/manual/en/book.opcache.php)| The Zend OPcache provides faster PHP execution through opcode caching and optimization. | This is a must-have for PHP performance.<br /><br />⚠️ OPcache is disabled by default for development. Set [`PHP_OPCACHE_ENABLE=1`](/docs/reference/environment-variable-specification)for production mode with tuned defaults. See the [OPcache tuning guide](/docs/guide/php-opcache-tuning).|
87
+
|[opcache](https://www.php.net/manual/en/book.opcache.php)| The Zend OPcache provides faster PHP execution through opcode caching and optimization. | This is a must-have for PHP performance.<br /><br />⚠️ OPcache is disabled by default so code edits show up right away. Set [`PHP_OPCACHE_ENABLE=1`](/docs/reference/environment-variable-specification)to turn it on with tuned defaults. See the [production performance tuning guide](/docs/guide/production-performance-tuning#php-opcache).|
88
88
|[mysqli](https://www.php.net/manual/en/book.mysqli.php)| The "MySQL Improved" extension is an older extension for connecting to MySQL 4.1 and above. |**Enabled for fpm-apache only**. This is a legacy MySQL connector required for WordPress.|
89
89
|[pcntl](https://www.php.net/manual/en/intro.pcntl.php)| Process Control support in PHP implements the Unix style of process creation, program execution, signal handling and process termination. | This is required for [Laravel queues and Laravel Horizon](https://laravel.com/docs/10.x/queues#timeout)|
90
90
|[pdo_mysql](https://www.php.net/manual/en/ref.pdo-mysql.php)| The MySQL PDO extension allows you to connect to MySQL databases. | MySQL and MariaDB databases are very popular. |
Copy file name to clipboardExpand all lines: docs/content/docs/3.framework-guides/2.wordpress/4.using-wordpress-with-docker.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,7 +157,7 @@ This approach prioritizes plugin compatibility over modern deployment practices.
157
157
::
158
158
159
159
::warning
160
-
With `PHP_OPCACHE_ENABLE=1`, PHP files are cached until the container restarts because [`PHP_OPCACHE_VALIDATE_TIMESTAMPS`](/docs/reference/environment-variable-specification) defaults to `0`. Updates made through the WordPress admin still work because WordPress clears the cache for the files it writes. Changes made with `git pull`, WP-CLI, SFTP, or plugins that write PHP files directly are not picked up until you restart the container. If you deploy this way, either restart the container after each update or set `PHP_OPCACHE_VALIDATE_TIMESTAMPS=1`. [Learn more in the OPcache tuning guide →](/docs/guide/php-opcache-tuning)
160
+
With `PHP_OPCACHE_ENABLE=1`, PHP files are cached until the container restarts because [`PHP_OPCACHE_VALIDATE_TIMESTAMPS`](/docs/reference/environment-variable-specification) defaults to `0`. Updates made through the WordPress admin still work because WordPress clears the cache for the files it writes with [`wp_opcache_invalidate()`](https://developer.wordpress.org/reference/functions/wp_opcache_invalidate/){target="_blank"}. Changes made with `git pull`, WP-CLI, SFTP, or plugins that write PHP files directly are not picked up until you restart the container. If you deploy this way, either restart the container after each update or set `PHP_OPCACHE_VALIDATE_TIMESTAMPS=1`. [Learn more in the production performance tuning guide →](/docs/guide/production-performance-tuning#php-opcache)
Copy file name to clipboardExpand all lines: docs/content/docs/8.reference/1.environment-variable-specification.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,23 +100,24 @@ Setting environment variables all depends on what method you're using to run you
100
100
`PHP_MAX_INPUT_TIME`<br />*Default: "-1"*|This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. Timing begins at the moment PHP is invoked at the server and ends when execution begins. The default setting is -1, which means that max_execution_time is used instead. Set to 0 to allow unlimited time. This directive is hardcoded to -1 for the CLI SAPI by PHP. (<atarget="_blank"href="https://php.net/max-input-time">Official docs</a>)|all
101
101
`PHP_MAX_INPUT_VARS`<br />*Default: "1000"*|Set the limits for number of input variables (e.g., POST, GET, or COOKIE variables) that PHP will process in a single request. (<atarget="_blank"href="https://www.php.net/manual/en/info.configuration.php#ini.max-input-vars">Official docs</a>)|all
102
102
`PHP_MEMORY_LIMIT`<br />*Default: "256M"*|Set the maximum amount of memory in bytes that a script is allowed to allocate. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.memory-limit">Official docs</a>)|all
103
-
`PHP_OPCACHE_ENABLE`<br />*Default: "0" (to keep developers sane)*|Enable or disable OPcache. `0` is development mode and `1` is production mode with the tuned defaults below. ⚠️ This will set **both values** for `opcache.enable` and `opcache.enable_cli`, so CLI commands like `php artisan` use OPcache too. See the [OPcache tuning guide](/docs/guide/php-opcache-tuning). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.enable">Official docs</a>)|all
103
+
`PHP_OPCACHE_ENABLE`<br />*Default: "0" (to keep developers sane)*|Enable or disable OPcache. `1` also applies the tuned `PHP_OPCACHE_*` defaults below. CLI commands like `php artisan` also use OPcache when `PHP_OPCACHE_ENABLE_CLI=1`. See the [production performance tuning guide](/docs/guide/production-performance-tuning#php-opcache). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.enable">Official docs</a>)|all
104
+
`PHP_OPCACHE_ENABLE_CLI`<br />*Default: "1"*|Enable or disable OPcache for CLI commands like `php artisan`. Only takes effect when `PHP_OPCACHE_ENABLE=1`. Set to `0` to keep OPcache on for the web server only, for example so `PHP_OPCACHE_PRELOAD` does not run on every CLI command. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.enable-cli">Official docs</a>)|all
104
105
`PHP_OPCACHE_ENABLE_FILE_OVERRIDE`<br />*Default: "0"*|Enable or disable file existence override (file_exists, etc.). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.enable-file-override">Official docs</a>)|all
105
106
`PHP_OPCACHE_FORCE_RESTART_TIMEOUT`<br />*Default: "180"*|The number of seconds to wait for a scheduled restart to begin if the cache isn't active, in seconds. If the timeout is hit, then OPcache assumes that something is wrong and will kill the processes holding locks on the cache to permit a restart. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.force-restart-timeout">Official docs</a>)|all
106
-
`PHP_OPCACHE_INTERNED_STRINGS_BUFFER`<br />*Default: "16"*|The amount of memory used to store interned strings, in megabytes. This is reserved inside `PHP_OPCACHE_MEMORY_CONSUMPTION`, not in addition to it. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.interned-strings-buffer">Official docs</a>)|all
107
+
`PHP_OPCACHE_INTERNED_STRINGS_BUFFER`<br />*Default: "32"*|The amount of memory used to store interned strings, in megabytes. This is reserved inside `PHP_OPCACHE_MEMORY_CONSUMPTION`, not in addition to it. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.interned-strings-buffer">Official docs</a>)|all
107
108
`PHP_OPCACHE_JIT`<br />*Default: "off"*|Enable or disable the JIT compiler. To turn it on, set this to `tracing`**and** set `PHP_OPCACHE_JIT_BUFFER_SIZE` to a non-zero value like `64M`. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit">Official docs</a>)|all
108
-
`PHP_OPCACHE_JIT_BUFFER_SIZE`<br />*Default: "0"*|The amount of shared memory to reserve for compiled JIT code. A zero value disables the JIT. This is reserved inside `PHP_OPCACHE_MEMORY_CONSUMPTION`. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit-buffer-size">Official docs</a>)|all
109
-
`PHP_OPCACHE_MAX_ACCELERATED_FILES`<br />*Default: "20000"*|The maximum number of keys (scripts) in the OPcache hash table. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.max-accelerated-files">Official docs</a>)|all
109
+
`PHP_OPCACHE_JIT_BUFFER_SIZE`<br />*Default: "0"*|The amount of shared memory to reserve for compiled JIT code. A zero value disables the JIT. This is added on top of `PHP_OPCACHE_MEMORY_CONSUMPTION`, so the shared memory segment becomes the sum of both. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit-buffer-size">Official docs</a>)|all
110
+
`PHP_OPCACHE_MAX_ACCELERATED_FILES`<br />*Default: "32531"*|The maximum number of keys (scripts) in the OPcache hash table. PHP rounds this up to the next value in its prime number table (16229, 32531, 65407, and so on), so `32531` is the exact value PHP uses and reports in `opcache_get_status()`. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.max-accelerated-files">Official docs</a>)|all
110
111
`PHP_OPCACHE_MEMORY_CONSUMPTION`<br />*Default: "256"*|The amount of shared memory reserved for OPcache, in megabytes. Memory is only used as files are cached, so a larger value costs nothing until it is needed. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.memory-consumption">Official docs</a>)|all
111
-
`PHP_OPCACHE_PRELOAD`<br />*Default: ""*|Path to a PHP script that OPcache compiles and runs at startup (preloading). Empty disables preloading. ⚠️ Since `PHP_OPCACHE_ENABLE` also enables OPcache for the CLI, the script runs on every `php` command too. Preloading as root requires `PHP_OPCACHE_PRELOAD_USER`. See the [OPcache tuning guide](/docs/guide/php-opcache-tuning). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload">Official docs</a>)|all
112
+
`PHP_OPCACHE_PRELOAD`<br />*Default: ""*|Path to a PHP script that OPcache compiles and runs at startup (preloading). Empty disables preloading. ⚠️ The script also runs on every `php` command unless `PHP_OPCACHE_ENABLE_CLI=0`. Preloading as root requires `PHP_OPCACHE_PRELOAD_USER`. See the [production performance tuning guide](/docs/guide/production-performance-tuning#php-opcache). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload">Official docs</a>)|all
112
113
`PHP_OPCACHE_PRELOAD_USER`<br />*Default: ""*|The system user to run the preload script as. Only needed when the web server runs as root, since PHP refuses to preload as root without it. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.preload-user">Official docs</a>)|all
113
114
`PHP_OPCACHE_REVALIDATE_FREQ`<br />*Default: "2"*|How often the OPcache checks for updates to cached files (in seconds). Only applies when `PHP_OPCACHE_VALIDATE_TIMESTAMPS=1`. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq">Official docs</a>)|all
114
-
`PHP_OPCACHE_SAVE_COMMENTS`<br />*Default: "1"*|Keep PHPDoc comments in the cached code. Setting this to `0` saves a little memory but breaks any code that reads PHPDoc annotations at runtime (Doctrine, PHPUnit, and many Laravel packages). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.save-comments">Official docs</a>)|all
115
+
`PHP_OPCACHE_SAVE_COMMENTS`<br />*Default: "1"*|Keep PHPDoc comments in the cached code. Setting this to `0` saves a little memory but breaks any code that reads PHPDoc annotations at runtime (Doctrine, Zend Framework 2, and PHPUnit). (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.save-comments">Official docs</a>)|all
115
116
`PHP_OPCACHE_VALIDATE_TIMESTAMPS`<br />*Default: "0"*|Whether OPcache checks for changes to files. With `0`, PHP files are cached until the container restarts, which is ideal for immutable containers. Set to `1` if you mount your code as a volume and still want OPcache enabled. (<atarget="_blank"href="https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.validate-timestamps">Official docs</a>)|all
116
117
`PHP_OPEN_BASEDIR`<br />*Default: "None"* |Limit the files that can be accessed by PHP to the specified directory-tree, including the file itself. `open_basedir` is just an extra safety net, that is in no way comprehensive, and can therefore not be relied upon when security is needed. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.open-basedir">Official docs</a>)| all
117
118
`PHP_POST_MAX_SIZE`<br />*Default: "100M"*|Sets max size of post data allowed. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.post-max-size">Official docs</a>)|all
118
119
`PHP_REALPATH_CACHE_SIZE`<br />*Default: "4096K"*|Size of the realpath cache. Applications with many files (large `vendor/` directories) may benefit from a larger cache. Note: the cache is disabled when `PHP_OPEN_BASEDIR` is set. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.realpath-cache-size">Official docs</a>)|all
119
-
`PHP_REALPATH_CACHE_TTL`<br />*Default: "120"*|The duration of time, in seconds for which to cache realpath information for a given file or directory. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.realpath-cache-ttl">Official docs</a>)|all
120
+
`PHP_REALPATH_CACHE_TTL`<br />*Default: "600"*|The duration of time, in seconds for which to cache realpath information for a given file or directory.`600` is the value Symfony's performance guide recommends for applications that open many PHP files. (<atarget="_blank"href="https://symfony.com/doc/current/performance.html#configure-the-php-realpath-cache">Symfony docs</a>) (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.realpath-cache-ttl">Official docs</a>)|all
120
121
`PHP_SESSION_COOKIE_HTTPONLY`<br />*Default: "On"*|Add the `HttpOnly` flag to the session cookie so browser scripts cannot read it. On by default as recommended by PHP. Only applies to native PHP sessions. Laravel manages its own session cookie flags. (<atarget="_blank"href="https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-httponly">Official docs</a>)|all
121
122
`PHP_SESSION_COOKIE_SECURE`<br />*Default: "false"*|Specifies whether the session cookie should only be sent over HTTPS. Off by default so local development over HTTP works. Set to `true` in production when serving over HTTPS. Only applies to native PHP sessions. Laravel manages its own session cookie flags. (<atarget="_blank"href="https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-secure">Official docs</a>)|all
122
123
`PHP_UPLOAD_MAX_FILE_SIZE`<br />*Default: "100M"*|The maximum size of an uploaded file. (<atarget="_blank"href="https://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize">Official docs</a>)|all
echo"👉 [NOTICE]: OPcache is in production mode. Code changes require a container restart. Learn more: https://serversideup.net/open-source/docker-php/docs/guide/php-opcache-tuning"
66
+
echo"👉 [NOTICE]: OPcache is enabled and PHP_OPCACHE_VALIDATE_TIMESTAMPS=0. Code changes require a container restart. Learn more: https://serversideup.net/open-source/docker-php/docs/guide/production-performance-tuning#php-opcache"
0 commit comments