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

Add info about optimized realpath_cache_settings #7939

Merged
merged 19 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 11 additions & 89 deletions src/cloud/project/magento-app-php-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type: php:<version>

### PHP extensions

You can enable additional PHP extensions in the `runtime:extension` section. Also, the extensions specified become available in the Docker PHP containers.
You can enable or disable PHP extensions in the `runtime:extension` section. Also, the extensions specified become available in the Docker PHP containers.

> .magento.app.yaml

Expand All @@ -41,96 +41,18 @@ php -m

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

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

- Default extensions:
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `gettext`
- `intl`
- `mysqli`
- `pcntl`
- `pdo_mysql`
- `soap`
- `sockets`
- `sysvmsg`
- `sysvsem`
- `sysvshm`
- `opcache`
- `zip`
{:.php-plugins-table}
| Default extensions | Installed extensions<br>that cannot be uninstalled | Extensions that can be installed<br> and uninstalled as needed|
|--------------------|---------------------|---------------------|
| `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`|

- Extensions that are installed and cannot be uninstalled:
- `ctype`
- `curl`
- `date`
- `dom`
- `fileinfo`
- `filter`
- `ftp`
- `hash`
- `iconv`
- `json`
- `mbstring`
- `mysqlnd`
- `openssl`
- `pcre`
- `pdo`
- `pdo_sqlite`
- `phar`
- `posix`
- `readline`
- `session`
- `sqlite3`
- `tokenizer`
- `xml`
- `xmlreader`
- `xmlwriter`

- Extensions that can be installed and uninstalled as needed:
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `geoip`
- `gettext`
- `gmp`
- `igbinary`
- `imagick`
- `imap`
- `intl`
- `ioncube`
- `ldap`
- `mailparse`
- `mcrypt`
- `msgpack`
- `mysqli`
- `oauth`
- `opcache`
- `pdo_mysql`
- `propro`
- `pspell`
- `raphf`
- `recode`
- `redis`
- `shmop`
- `soap`
- `sockets`
- `sodium`
- `ssh2`
- `sysvmsg`
- `sysvsem`
- `sysvshm`
- `tidy`
- `xdebug`
- `xmlrpc`
- `xsl`
- `yaml`
- `zip`
- `pcntl`
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).

{:.bs-callout-warning}
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.

### Custom PHP configuration

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).
40 changes: 33 additions & 7 deletions src/cloud/project/magento-app-php-ini.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,48 @@ functional_areas:
- Setup
- Application
---
You can also create and push a `php.ini` file that is appended to the configuration maintained by {{site.data.var.ee}}.

In your repository, the `php.ini` file should be added to the root of the application (the repository root).
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}}.

In your repository, add the `php.ini` file to the root of the application (the repository root).

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

For example, if you need to increase the PHP memory limit:
## Increase PHP memory limit

```bash
memory_limit = 756M
To increase the PHP memory limit, add the following setting to the `php.ini` file:

```php
memory_limit = 1G
```

For debugging, increase the value to 2G.

## Optimize realpath_cache configuration

Set the following `realpath_cache` settings to improve Magento performance.

```conf
;
; Increase realpath cache size
;
realpath_cache_size = 10M

;
; Increase realpath cache ttl
;
realpath_cache_ttl = 7200
```

For a list of recommended PHP configuration settings, see [Required PHP settings]({{ site.baseurl }}/guides/v2.3/install-gde/prereq/php-settings.html).
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.

{:.bs-callout-info}
For a list of recommended PHP configuration settings, see [Required PHP settings]({{ site.baseurl }}/guides/v2.4/install-gde/prereq/php-settings.html).

## Check custom php.ini settings

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:
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:

```bash
cat /etc/php5/fpm/php.ini
Expand Down
4 changes: 2 additions & 2 deletions src/guides/v2.3/config-guide/multi-site/ms_nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ To modify the `nginx.conf.sample` file:
fastcgi_buffers 1024 4k;

fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
fastcgi_param PHP_VALUE "memory_limit=1G \n max_execution_time=18000";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;

Expand Down Expand Up @@ -224,7 +224,7 @@ location ~ (index|get|static|report|404|503|health_check)\.php$ {
fastcgi_buffers 1024 4k;

fastcgi_param PHP_FLAG "session.auto_start=off \n suhosin.session.cryptua=off";
fastcgi_param PHP_VALUE "memory_limit=756M \n max_execution_time=18000";
fastcgi_param PHP_VALUE "memory_limit=1G \n max_execution_time=18000";
fastcgi_read_timeout 600s;
fastcgi_connect_timeout 600s;

Expand Down
60 changes: 46 additions & 14 deletions src/guides/v2.4/install-gde/prereq/php-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,25 @@ Magento requires a set of extensions to be installed:
<!--{% assign packages = site.data.codebase.v2_4.open-source.composer_lock.packages %}-->
{% include install/php-extensions-template.md %}

In the command line, type:
{:.bs-callout-warning}
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.

```bash
php -m
```
{:.procedure}
To verify installed extensions:

to see the list of installed modules. Verify that the listed extensions are installed.
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:
1. List installed modules.

```bash
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
```
```bash
php -m
```

1. Verify that all required extensions are installed.

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:

```bash
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
```

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

Our detailed recommendations are:

- Compiling code or deploying static assets, `756M`
- Installing and updating Magento components from Magento Marketplace, `2G`
- Testing, `~3-4G`
- Compiling code or deploying static assets, `1G`
- Debugging, `2G`
- Testing, `~3-4G`

- Increase the values for the PHP `realpath_cache_size` and `realpath_cache_ttl` to recommended settings:

```conf
realpath_cache_size=10M
meker12 marked this conversation as resolved.
Show resolved Hide resolved
realpath_cache_ttl=7200
```

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.

- 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.

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

{:.bs-callout-info}
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.
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.

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

Expand Down Expand Up @@ -136,15 +152,31 @@ To set PHP options:
```

1. Add the time zone setting you found in step 2.
1. Change the value of `memory_limit` to one of the values at the beginning of this section.

1. Change the value of `memory_limit` to one of the values recommended at the beginning of this section.

For example,

```conf
memory_limit=2G
```

1. Add or update the `realpath_cache` configuration to match the following values:

```conf
;
; Increase realpath cache size
;
realpath_cache_size = 10M
meker12 marked this conversation as resolved.
Show resolved Hide resolved

;
; Increase realpath cache ttl
;
realpath_cache_ttl = 7200
```

1. Save your changes and exit the text editor.

1. Open the other `php.ini` (if they are different) and make the same changes in it.

## Step 3: Set OPcache options {#php-required-opcache}
Expand Down
12 changes: 1 addition & 11 deletions src/guides/v2.4/install-gde/prereq/prereq-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ To install or upgrade Apache, see [Apache]({{page.baseurl}}/install-gde/prereq/a

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

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

### MySQL

Expand Down Expand Up @@ -134,13 +134,3 @@ curl -XGET 'localhost:9200'
Next step

[Choose how to install the Magento software]({{page.baseurl}}/install-gde/bk-install-guide.html)

{:.ref-header}
Related topics

* [MySQL]({{page.baseurl}}/install-gde/prereq/mysql.html)
* [Apache]({{page.baseurl}}/install-gde/prereq/apache.html)
* [PHP]({{page.baseurl}}/install-gde/prereq/php-settings.html)
* [Elasticsearch]({{page.baseurl}}/install-gde/prereq/elasticsearch.html)
* [Installing optional software]({{page.baseurl}}/install-gde/prereq/optional.html)
* [How to get the Magento software]({{ page.baseurl }}/install-gde/bk-install-guide.html)
13 changes: 12 additions & 1 deletion src/guides/v2.4/performance-best-practices/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,18 @@ The presence of any profiling and debugging extensions can negatively impact the

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

`memory_limit=768MB`
`memory_limit=1G`

For debugging, increase this value to 2G.

#### Realpath_cache configuration

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.

```text
realpath_cache_size=10M
meker12 marked this conversation as resolved.
Show resolved Hide resolved
realpath_cache_ttl=7200
```

#### ByteCode

Expand Down