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
With PHP preloading, you can instruct the server to load essential files like functions and classes into memory during startup.
63
+
This means these elements are readily available for all requests, skipping the usual loading process and boosting your
64
+
application's performance. However, this comes at the cost of increased memory usage and requires restarting the
65
+
PHP engine for changes to take effect.
66
+
67
+
.. note:: If you want to use `Preloading <https://www.php.net/manual/en/opcache.preloading.php>`_,
68
+
we provide a `preload script <https://github.com/codeigniter4/CodeIgniter4/blob/develop/preload.php>`_.
69
+
70
+
Requirement
71
+
-----------
72
+
73
+
Using preloading requires one dedicated PHP handler. Normally, web servers are configured to use one PHP handler, so one app requires a dedicated web server.
74
+
If you want to use preloading for multiple apps on one web server, configure your server to use virtual hosts with multiple PHP handlers like multiple PHP-FPMs, with each virtual host using one PHP handler.
75
+
Preloading keeps the relevant definitions in memory by reading the files specified in ``opcache.preload``.
76
+
77
+
.. note:: See :ref:`running-multiple-app` to make one core CodeIgniter4 to handle your multiple apps.
78
+
79
+
Configuration
80
+
-------------
81
+
82
+
Open ``php.ini`` or ``xx-opcache.ini`` if you have split INI configuration in PHP, and recommend to set ``opcache.preload=/path/to/preload.php`` and ``opcache.preload_user=myuser``.
83
+
84
+
.. note:: ``myuser`` is user running in your web server. If you want to find the location of the split INI configuration, just run ``php --ini`` or open file ``phpinfo()`` and search *Additional .ini files parsed*.
85
+
86
+
Make sure you use the appstarter installation. If using manual installation, you must change the directory in ``include`` path.
0 commit comments