From 7187893162f8702d6d243a32d99725f9a8ad783f Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sat, 2 Mar 2024 09:31:58 +0700 Subject: [PATCH 01/10] added SQLite3 to exclude database --- preload.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/preload.php b/preload.php index 63c781c220c5..719923b7096b 100644 --- a/preload.php +++ b/preload.php @@ -49,11 +49,12 @@ class preload */ private array $paths = [ [ - 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', + 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // change this path if you using manual installation 'exclude' => [ // Not needed if you don't use them. '/system/Database/OCI8/', '/system/Database/Postgre/', + '/system/Database/SQLite3/', '/system/Database/SQLSRV/', // Not needed. '/system/Database/Seeder.php', From 67268a1ddcbaf85f52ef06e5bbbcfef3d5807cbc Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sat, 2 Mar 2024 10:55:38 +0700 Subject: [PATCH 02/10] docs: note preload to deployment --- .../source/installation/deployment.rst | 30 +++++++++++++++++-- .../source/installation/preloading/001.php | 20 +++++++++++++ 2 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 user_guide_src/source/installation/preloading/001.php diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index b089b41642e0..4759b9c83fe0 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -59,9 +59,33 @@ See :ref:`file-locator-caching`. PHP Preloading ============== -If you want to use `Preloading `_, -we provide a -`preload script `_. +Every application consists of a large number of classes in many different locations. +The framework provides classes for core functionality. As defined by `PHP RFC `_, +Preloading is implemented as a part of the opcache on top of another (already committed) patch that introduces ``immutable`` +classes and functions. They assume that the immutable part is stored in shared memory once (for all processes) +and never copied to process memory, but the variable part is specific for each process. +The patch introduced the MAP_PTR pointer data structure, that allows pointers from SHM to process memory. + +.. note:: If you want to use `Preloading `_, + we provide a `preload script `_. + +Requirement +----------- + +Preloading for classes that are used more than once in the same server is not possible. You must isolated application to ``dedicated`` server, +even if the servers are not physical machines but virtual machines or containers. Preloading keeps the relevant definitions +in memory by reading the files specified in ``opcache.preload``. + +Configuration +------------- + +Open ``php.ini`` or ``xx-opcache.ini`` if you have split INI configuration in PHP, and recommendation set ``opcache.preload=/path/to/preload.php`` and ``opcache.preload_user=myuser``. + +.. note:: ``myuser`` is user running in your web server + +Make sure you use appstater installation, If using manual installation you must change directory in include path. + +.. literalinclude:: preloading/001.php .. _deployment-to-shared-hosting-services: diff --git a/user_guide_src/source/installation/preloading/001.php b/user_guide_src/source/installation/preloading/001.php new file mode 100644 index 000000000000..3a56fe6a9c68 --- /dev/null +++ b/user_guide_src/source/installation/preloading/001.php @@ -0,0 +1,20 @@ + '/system', // <== in this + // ... + ], + ]; + + // ... +} + +// ... From 97754723cfc91b484bd97e4d96a6ae3f0b5d0b24 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sat, 2 Mar 2024 13:08:34 +0700 Subject: [PATCH 03/10] fix: typo --- preload.php | 2 +- user_guide_src/source/installation/deployment.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/preload.php b/preload.php index 719923b7096b..2fa699388270 100644 --- a/preload.php +++ b/preload.php @@ -49,7 +49,7 @@ class preload */ private array $paths = [ [ - 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // change this path if you using manual installation + 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation 'exclude' => [ // Not needed if you don't use them. '/system/Database/OCI8/', diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 4759b9c83fe0..14966f4fd529 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -72,7 +72,7 @@ The patch introduced the MAP_PTR pointer data structure, that allows pointers fr Requirement ----------- -Preloading for classes that are used more than once in the same server is not possible. You must isolated application to ``dedicated`` server, +Preloading for classes that are used more than once in the same server is not possible. You must isolated application to *dedicated* server, even if the servers are not physical machines but virtual machines or containers. Preloading keeps the relevant definitions in memory by reading the files specified in ``opcache.preload``. From c01bc7261d8747d52874fc72a95523b785ae7b10 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sat, 2 Mar 2024 15:07:11 +0700 Subject: [PATCH 04/10] docs: change explanation --- user_guide_src/source/installation/deployment.rst | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 14966f4fd529..7ba01e95ba61 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -59,12 +59,10 @@ See :ref:`file-locator-caching`. PHP Preloading ============== -Every application consists of a large number of classes in many different locations. -The framework provides classes for core functionality. As defined by `PHP RFC `_, -Preloading is implemented as a part of the opcache on top of another (already committed) patch that introduces ``immutable`` -classes and functions. They assume that the immutable part is stored in shared memory once (for all processes) -and never copied to process memory, but the variable part is specific for each process. -The patch introduced the MAP_PTR pointer data structure, that allows pointers from SHM to process memory. +With PHP preloading, you can instruct the server to load essential files like functions and classes into memory during startup. +This means these elements are readily available for all requests, skipping the usual loading process and boosting your +application's performance. However, this comes at the cost of increased memory usage and requires restarting the +PHP engine for changes to take effect. .. note:: If you want to use `Preloading `_, we provide a `preload script `_. From d4cd63ec22c58353da953f6e3af36a845cbdab0e Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:36:35 +0700 Subject: [PATCH 05/10] Update user_guide_src/source/installation/preloading/001.php Co-authored-by: kenjis --- user_guide_src/source/installation/preloading/001.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/preloading/001.php b/user_guide_src/source/installation/preloading/001.php index 3a56fe6a9c68..dbb56e235fc4 100644 --- a/user_guide_src/source/installation/preloading/001.php +++ b/user_guide_src/source/installation/preloading/001.php @@ -9,7 +9,7 @@ class preload */ private array $paths = [ [ - 'include' => '/system', // <== in this + 'include' => __DIR__ . '/system', // <== in this // ... ], ]; From 48550aa3929838ad4cdfb048b3be1bbf43882157 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Tue, 5 Mar 2024 17:32:42 +0700 Subject: [PATCH 06/10] fix: typography --- user_guide_src/source/installation/deployment.rst | 6 +++--- user_guide_src/source/installation/preloading/001.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 7ba01e95ba61..4c11bd98e456 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -77,11 +77,11 @@ in memory by reading the files specified in ``opcache.preload``. Configuration ------------- -Open ``php.ini`` or ``xx-opcache.ini`` if you have split INI configuration in PHP, and recommendation set ``opcache.preload=/path/to/preload.php`` and ``opcache.preload_user=myuser``. +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``. -.. note:: ``myuser`` is user running in your web server +.. note:: ``myuser`` is user running in your web server. If you want find location split INI configuration, just run ``php --ini`` or open file ``phpinfo()`` and search *Additional .ini files parsed*. -Make sure you use appstater installation, If using manual installation you must change directory in include path. +Make sure you use the appstater installation. If using manual installation, you must change the directory in ``include`` path. .. literalinclude:: preloading/001.php diff --git a/user_guide_src/source/installation/preloading/001.php b/user_guide_src/source/installation/preloading/001.php index dbb56e235fc4..059c6d846613 100644 --- a/user_guide_src/source/installation/preloading/001.php +++ b/user_guide_src/source/installation/preloading/001.php @@ -9,7 +9,7 @@ class preload */ private array $paths = [ [ - 'include' => __DIR__ . '/system', // <== in this + 'include' => __DIR__ . '/system', // <== change this line to where CI is installed // ... ], ]; From 64fa90a5643c532512b1e5bb3ee210043f6984d5 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Wed, 6 Mar 2024 09:59:22 +0700 Subject: [PATCH 07/10] change notes --- user_guide_src/source/general/managing_apps.rst | 2 ++ user_guide_src/source/installation/deployment.rst | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/user_guide_src/source/general/managing_apps.rst b/user_guide_src/source/general/managing_apps.rst index e3c6df0119b0..ff664668bf8b 100644 --- a/user_guide_src/source/general/managing_apps.rst +++ b/user_guide_src/source/general/managing_apps.rst @@ -50,6 +50,8 @@ they can find the **Paths** configuration file: .. literalinclude:: managing_apps/003.php +.. _running-multiple-app: + Running Multiple Applications with one CodeIgniter Installation =============================================================== diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 4c11bd98e456..11063b1709c3 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -70,9 +70,10 @@ PHP engine for changes to take effect. Requirement ----------- -Preloading for classes that are used more than once in the same server is not possible. You must isolated application to *dedicated* server, -even if the servers are not physical machines but virtual machines or containers. Preloading keeps the relevant definitions -in memory by reading the files specified in ``opcache.preload``. +Preloading for classes that are used more than once in the same handler PHP version server is not possible. You must *isolated* one application to *dedicated* handler PHP version in web server, in this example *php8-3* just handle one apps. +Preloading keeps the relevant definitions in memory by reading the files specified in ``opcache.preload``. + +.. note:: See :ref:`running-multiple-app` to make one core CodeIgniter4 to handle your multiple apps. Configuration ------------- From 27973c7363a80a55a580a5145f5ec6b595fc5d92 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Thu, 7 Mar 2024 16:58:58 +0700 Subject: [PATCH 08/10] change notes --- user_guide_src/source/installation/deployment.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 11063b1709c3..6c8dcce53b48 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -70,7 +70,8 @@ PHP engine for changes to take effect. Requirement ----------- -Preloading for classes that are used more than once in the same handler PHP version server is not possible. You must *isolated* one application to *dedicated* handler PHP version in web server, in this example *php8-3* just handle one apps. +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. +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. Preloading keeps the relevant definitions in memory by reading the files specified in ``opcache.preload``. .. note:: See :ref:`running-multiple-app` to make one core CodeIgniter4 to handle your multiple apps. From 6aed088ca4341198d0bf96a591a16ce3e32493ef Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean <97607754+ddevsr@users.noreply.github.com> Date: Fri, 8 Mar 2024 22:06:30 +0700 Subject: [PATCH 09/10] Update user_guide_src/source/installation/deployment.rst Co-authored-by: John Paul E. Balandan, CPA --- user_guide_src/source/installation/deployment.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 6c8dcce53b48..818d966d7fd3 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -83,7 +83,7 @@ Open ``php.ini`` or ``xx-opcache.ini`` if you have split INI configuration in PH .. note:: ``myuser`` is user running in your web server. If you want find location split INI configuration, just run ``php --ini`` or open file ``phpinfo()`` and search *Additional .ini files parsed*. -Make sure you use the appstater installation. If using manual installation, you must change the directory in ``include`` path. +Make sure you use the appstarter installation. If using manual installation, you must change the directory in ``include`` path. .. literalinclude:: preloading/001.php From 4d121a78130d287a10d8f0aead97074200175a09 Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sat, 9 Mar 2024 06:30:33 +0700 Subject: [PATCH 10/10] fix: change notes --- user_guide_src/source/installation/deployment.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 818d966d7fd3..8a855e0c8e99 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -81,7 +81,7 @@ Configuration 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``. -.. note:: ``myuser`` is user running in your web server. If you want find location split INI configuration, just run ``php --ini`` or open file ``phpinfo()`` and search *Additional .ini files parsed*. +.. 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*. Make sure you use the appstarter installation. If using manual installation, you must change the directory in ``include`` path.