Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit f05a450

Browse files
meker12Barny Shergoldhguthriejeff-matthews
authored
Add info about optimized realpath_cache_settings (#7939)
* Add info about optimized realpath_cache_settings * Fix markdown syntax. * Update src/cloud/project/magento-app-php-application.md Co-authored-by: Barny Shergold <[email protected]> * Fix PHP extension table * Apply suggestions from code review * Update src/cloud/project/magento-app-php-application.md * - Fix link syntax and remove related topics from Prerequisites topic - Correct recommended memory limit and realpath_cache values - Corrected table with supported PHP extensions per review feedback * Added note about ext-sockets extension to required PHP extensions * Apply suggestions from code review Co-authored-by: hguthrie <[email protected]> * Update src/guides/v2.4/install-gde/prereq/php-settings.md * Apply suggestions from code review Co-authored-by: Barny Shergold <[email protected]> * Apply suggestions from code review Co-authored-by: Jeff Matthews <[email protected]> * Update src/guides/v2.4/install-gde/prereq/php-settings.md * Update src/guides/v2.4/install-gde/prereq/php-settings.md * Fix broken link Co-authored-by: Barny Shergold <[email protected]> Co-authored-by: hguthrie <[email protected]> Co-authored-by: Jeff Matthews <[email protected]>
1 parent 1cddfa1 commit f05a450

File tree

6 files changed

+105
-124
lines changed

6 files changed

+105
-124
lines changed

src/cloud/project/magento-app-php-application.md

Lines changed: 11 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type: php:<version>
1616
1717
### PHP extensions
1818
19-
You can enable additional PHP extensions in the `runtime:extension` section. Also, the extensions specified become available in the Docker PHP containers.
19+
You can enable or disable PHP extensions in the `runtime:extension` section. Also, the extensions specified become available in the Docker PHP containers.
2020

2121
> .magento.app.yaml
2222

@@ -41,96 +41,18 @@ php -m
4141

4242
For details about a specific PHP extension, see the [PHP Extension List](https://www.php.net/manual/en/extensions.alphabetical.php).
4343

44-
{{site.data.var.ece}} supports the following extensions:
44+
The following table shows the supported PHP extensions when deploying {{site.data.var.ee}} on the Cloud platform.
4545

46-
- Default extensions:
47-
- `bcmath`
48-
- `bz2`
49-
- `calendar`
50-
- `exif`
51-
- `gd`
52-
- `gettext`
53-
- `intl`
54-
- `mysqli`
55-
- `pcntl`
56-
- `pdo_mysql`
57-
- `soap`
58-
- `sockets`
59-
- `sysvmsg`
60-
- `sysvsem`
61-
- `sysvshm`
62-
- `opcache`
63-
- `zip`
46+
{:.php-plugins-table}
47+
| Default extensions | Installed extensions<br>that cannot be uninstalled | Extensions that can be installed<br> and uninstalled as needed|
48+
|--------------------|---------------------|---------------------|
49+
| `bcmath`<br> `bz2`<br> `calendar`<br> `exif`<br> `gd`<br> `gettext`<br> `intl`<br> `mysqli`<br> `pcntl`<br> `pdo_mysql`<br> `soap`<br> `sockets`<br> `sysvmsg`<br> `sysvsem`<br> `sysvshm`<br> `opcache`<br> `zip` |`ctype`<br> `curl`<br> `date`<br> `dom`<br> `fileinfo`<br> `filter`<br> `ftp`<br> `hash`<br> `iconv`<br> `json`<br> `mbstring`<br> `mysqlnd`<br> `openssl`<br> `pcre`<br> `pdo`<br> `pdo_sqlite`<br> `phar`<br> `posix`<br> `readline`<br> `session`<br> `sqlite3`<br> `tokenizer`<br> `xml`<br> `xmlreader`<br> `xmlwriter`<br> |`geoip`<br>`gmp`<br> `igbinary`<br> `imagick`<br> `imap`<br>`ioncube`<br> `ldap`<br> `mailparse`<br> `mcrypt`<br> `msgpack`<br> `mysqli`<br> `oauth`<br> `pdo_mysql`<br> `propro`<br> `pspell`<br> `raphf`<br> `recode`<br> `redis`<br> `shmop` `sockets`<br> `sodium`<br> `ssh2`<br>`tidy`<br> `xdebug`<br> `xmlrpc`<br> `xsl`<br> `yaml`|
6450

65-
- Extensions that are installed and cannot be uninstalled:
66-
- `ctype`
67-
- `curl`
68-
- `date`
69-
- `dom`
70-
- `fileinfo`
71-
- `filter`
72-
- `ftp`
73-
- `hash`
74-
- `iconv`
75-
- `json`
76-
- `mbstring`
77-
- `mysqlnd`
78-
- `openssl`
79-
- `pcre`
80-
- `pdo`
81-
- `pdo_sqlite`
82-
- `phar`
83-
- `posix`
84-
- `readline`
85-
- `session`
86-
- `sqlite3`
87-
- `tokenizer`
88-
- `xml`
89-
- `xmlreader`
90-
- `xmlwriter`
91-
92-
- Extensions that can be installed and uninstalled as needed:
93-
- `bcmath`
94-
- `bz2`
95-
- `calendar`
96-
- `exif`
97-
- `gd`
98-
- `geoip`
99-
- `gettext`
100-
- `gmp`
101-
- `igbinary`
102-
- `imagick`
103-
- `imap`
104-
- `intl`
105-
- `ioncube`
106-
- `ldap`
107-
- `mailparse`
108-
- `mcrypt`
109-
- `msgpack`
110-
- `mysqli`
111-
- `oauth`
112-
- `opcache`
113-
- `pdo_mysql`
114-
- `propro`
115-
- `pspell`
116-
- `raphf`
117-
- `recode`
118-
- `redis`
119-
- `shmop`
120-
- `soap`
121-
- `sockets`
122-
- `sodium`
123-
- `ssh2`
124-
- `sysvmsg`
125-
- `sysvsem`
126-
- `sysvshm`
127-
- `tidy`
128-
- `xdebug`
129-
- `xmlrpc`
130-
- `xsl`
131-
- `yaml`
132-
- `zip`
133-
- `pcntl`
51+
The PHP module requirements for {{ site.data.var.ee }} are tied to the Magento version. See [PHP requirements]({{ site.baseurl }}/guides/v2.4/install-gde/prereq/php-settings.html).
13452

13553
{:.bs-callout-warning}
13654
PHP compiled with debug is not supported and the Probe may conflict with XDebug or XHProf. Disable those extensions when enabling the Probe. The Probe conflicts with some PHP extensions like Pinba or IonCube.
55+
56+
### Custom PHP configuration
57+
58+
You can customize the PHP settings for a Cloud environment by adding a `php.ini` file to your project. See [Customize PHP.INI]({{ site.baseurl }}/cloud/project/magento-app-php-ini.html).

src/cloud/project/magento-app-php-ini.md

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,48 @@ functional_areas:
66
- Setup
77
- Application
88
---
9-
You can also create and push a `php.ini` file that is appended to the configuration maintained by {{site.data.var.ee}}.
109

11-
In your repository, the `php.ini` file should be added to the root of the application (the repository root).
10+
You can customize the PHP settings for your environment using a `php.ini` file that is appended to the configuration maintained by {{site.data.var.ee}}.
11+
12+
In your repository, add the `php.ini` file to the root of the application (the repository root).
1213

1314
{:.bs-callout-info}
1415
Configuring PHP settings improperly can cause issues. We recommend only advanced administrators set these options.
1516

16-
For example, if you need to increase the PHP memory limit:
17+
## Increase PHP memory limit
1718

18-
```bash
19-
memory_limit = 756M
19+
To increase the PHP memory limit, add the following setting to the `php.ini` file:
20+
21+
```php
22+
memory_limit = 1G
23+
```
24+
25+
For debugging, increase the value to 2G.
26+
27+
## Optimize realpath_cache configuration
28+
29+
Set the following `realpath_cache` settings to improve Magento performance.
30+
31+
```conf
32+
;
33+
; Increase realpath cache size
34+
;
35+
realpath_cache_size = 10M
36+
37+
;
38+
; Increase realpath cache ttl
39+
;
40+
realpath_cache_ttl = 7200
2041
```
2142

22-
For a list of recommended PHP configuration settings, see [Required PHP settings]({{ site.baseurl }}/guides/v2.3/install-gde/prereq/php-settings.html).
43+
These settings allow PHP processes to cache paths to files instead of looking them up each time a page loads. See [Performance Tuning](https://www.php.net/manual/en/ini.core.php) in the PHP documentation.
44+
45+
{:.bs-callout-info}
46+
For a list of recommended PHP configuration settings, see [Required PHP settings]({{ site.baseurl }}/guides/v2.4/install-gde/prereq/php-settings.html).
47+
48+
## Check custom php.ini settings
2349

24-
After pushing your file, you can check that the custom PHP configuration has been added to your environment by [creating an SSH tunnel]({{ site.baseurl }}/cloud/env/environments-start.html#env-start-tunn) to your environment and entering:
50+
After pushing the `php.ini` changes to your Cloud environment, you can check that the custom PHP configuration has been added to your environment by [creating an SSH tunnel]({{ site.baseurl }}/cloud/env/environments-start.html#env-start-tunn) to your environment and entering:
2551

2652
```bash
2753
cat /etc/php5/fpm/php.ini

src/guides/v2.3/config-guide/multi-site/ms_nginx.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ To modify the `nginx.conf.sample` file:
196196
fastcgi_buffers 1024 4k;
197197
198198
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
199-
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
199+
fastcgi_param PHP_VALUE "memory_limit=1G \n max_execution_time=18000";
200200
fastcgi_read_timeout 600s;
201201
fastcgi_connect_timeout 600s;
202202
@@ -224,7 +224,7 @@ location ~ (index|get|static|report|404|503|health_check)\.php$ {
224224
fastcgi_buffers 1024 4k;
225225
226226
fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
227-
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
227+
fastcgi_param PHP_VALUE "memory_limit=1G \n max_execution_time=18000";
228228
fastcgi_read_timeout 600s;
229229
fastcgi_connect_timeout 600s;
230230

src/guides/v2.4/install-gde/prereq/php-settings.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,25 @@ Magento requires a set of extensions to be installed:
4141
<!--{% assign packages = site.data.codebase.v2_4.open-source.composer_lock.packages %}-->
4242
{% include install/php-extensions-template.md %}
4343

44-
In the command line, type:
44+
{:.bs-callout-warning}
45+
If you install Magento 2.3 by cloning the [magento/magento2](https://github.com/magento/magento2) GitHub repository, you must have the [ext-sockets](https://github.com/php-amqplib/php-amqplib/blob/master/CHANGELOG.md#281---2018-11-13) extension installed on your system. The `ext-sockets` extension is required for Magento 2.4.
4546

46-
```bash
47-
php -m
48-
```
47+
{:.procedure}
48+
To verify installed extensions:
4949

50-
to see the list of installed modules. Verify that the listed extensions are installed.
51-
If any modules are missing, they are added using the same workflow used for installing PHP. For example, if you use `yum` to install PHP, the PHP 7.4 modules can be added with:
50+
1. List installed modules.
5251

53-
```bash
54-
yum -y install php74u-pdo php74u-mysqlnd php74u-opcache php74u-xml php74u-gd php74u-devel php74u-mysql php74u-intl php74u-mbstring php74u-bcmath php74u-json php74u-iconv php74u-soap
55-
```
52+
```bash
53+
php -m
54+
```
55+
56+
1. Verify that all required extensions are installed.
57+
58+
1. Add any missing modules using the same workflow used for installing PHP. For example, if you use `yum` to install PHP, the PHP 7.4 modules can be added with:
59+
60+
```bash
61+
yum -y install php74u-pdo php74u-mysqlnd php74u-opcache php74u-xml php74u-gd php74u-devel php74u-mysql php74u-intl php74u-mbstring php74u-bcmath php74u-json php74u-iconv php74u-soap
62+
```
5663

5764
{:.bs-callout-info}
5865
The `bcmath` extension is required for {{site.data.var.ee}} only.
@@ -69,9 +76,18 @@ PHP Warning: date(): It is not safe to rely on the system's timezone settings.
6976

7077
Our detailed recommendations are:
7178

72-
- Compiling code or deploying static assets, `756M`
73-
- Installing and updating Magento components from Magento Marketplace, `2G`
74-
- Testing, `~3-4G`
79+
- Compiling code or deploying static assets, `1G`
80+
- Debugging, `2G`
81+
- Testing, `~3-4G`
82+
83+
- Increase the values for the PHP `realpath_cache_size` and `realpath_cache_ttl` to recommended settings:
84+
85+
```conf
86+
realpath_cache_size=10M
87+
realpath_cache_ttl=7200
88+
```
89+
90+
These settings allow PHP processes to cache paths to files instead of looking them up each time a page loads. See [Performance Tuning](https://www.php.net/manual/en/ini.core.php) in the PHP documentation.
7591

7692
- Enable [`opcache.save_comments`](https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.save-comments){:target="_blank"}, which is required for Magento 2.1 and later.
7793

@@ -80,7 +96,7 @@ PHP Warning: date(): It is not safe to rely on the system's timezone settings.
8096
Magento 2.1 and later use PHP code comments for code generation.
8197

8298
{:.bs-callout-info}
83-
To avoid issues during installation and upgrade, we strongly recommend you apply the same PHP settings to both the PHP command-line configuration and the PHP web server plug-in's configuration. For more information, see the next section.
99+
To avoid issues during installation and upgrade, we strongly recommend you apply the same PHP settings to both the PHP command-line configuration and the PHP web server plug-in configuration. For more information, see the next section.
84100

85101
## Step 1: Find PHP configuration files {#php-required-find}
86102

@@ -136,15 +152,31 @@ To set PHP options:
136152
```
137153

138154
1. Add the time zone setting you found in step 2.
139-
1. Change the value of `memory_limit` to one of the values at the beginning of this section.
155+
156+
1. Change the value of `memory_limit` to one of the values recommended at the beginning of this section.
140157

141158
For example,
142159

143160
```conf
144161
memory_limit=2G
145162
```
146163

164+
1. Add or update the `realpath_cache` configuration to match the following values:
165+
166+
```conf
167+
;
168+
; Increase realpath cache size
169+
;
170+
realpath_cache_size = 10M
171+
172+
;
173+
; Increase realpath cache ttl
174+
;
175+
realpath_cache_ttl = 7200
176+
```
177+
147178
1. Save your changes and exit the text editor.
179+
148180
1. Open the other `php.ini` (if they are different) and make the same changes in it.
149181

150182
## Step 3: Set OPcache options {#php-required-opcache}

src/guides/v2.4/install-gde/prereq/prereq-overview.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ To install or upgrade Apache, see [Apache]({{page.baseurl}}/install-gde/prereq/a
6565

6666
{% include install/php-versions-2.4.md %}
6767

68-
See [PHP][] for info on PHP requirements.
68+
See [PHP]({{page.baseurl}}/install-gde/prereq/php-settings.html) for info on PHP requirements.
6969

7070
### MySQL
7171

@@ -134,13 +134,3 @@ curl -XGET 'localhost:9200'
134134
Next step
135135

136136
[Choose how to install the Magento software]({{page.baseurl}}/install-gde/bk-install-guide.html)
137-
138-
{:.ref-header}
139-
Related topics
140-
141-
* [MySQL]({{page.baseurl}}/install-gde/prereq/mysql.html)
142-
* [Apache]({{page.baseurl}}/install-gde/prereq/apache.html)
143-
* [PHP]({{page.baseurl}}/install-gde/prereq/php-settings.html)
144-
* [Elasticsearch]({{page.baseurl}}/install-gde/prereq/elasticsearch.html)
145-
* [Installing optional software]({{page.baseurl}}/install-gde/prereq/optional.html)
146-
* [How to get the Magento software]({{ page.baseurl }}/install-gde/bk-install-guide.html)

src/guides/v2.4/performance-best-practices/software.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,18 @@ The presence of any profiling and debugging extensions can negatively impact the
5858

5959
To guarantee successful execution of all Magento instances without dumping data or code to disk, set the memory limit as follows:
6060

61-
`memory_limit=768MB`
61+
`memory_limit=1G`
62+
63+
For debugging, increase this value to 2G.
64+
65+
#### Realpath_cache configuration
66+
67+
To improve Magento performance, add or update the following recommended `realpath_cache` settings in the `php.ini` file. This configuration allows PHP processes to cache paths to files instead of looking them up each time a page loads. See [Performance Tuning](https://www.php.net/manual/en/ini.core.php) in the PHP documentation.
68+
69+
```text
70+
realpath_cache_size=10M
71+
realpath_cache_ttl=7200
72+
```
6273

6374
#### ByteCode
6475

0 commit comments

Comments
 (0)