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 1 commit
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
99 changes: 11 additions & 88 deletions src/cloud/project/magento-app-php-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,96 +41,19 @@ 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 show the supported PHP extensions when deploying {{site.data.var.ee}} on the Cloud platform.
meker12 marked this conversation as resolved.
Show resolved Hide resolved

- Default extensions:
- `bcmath`
- `bz2`
- `calendar`
- `exif`
- `gd`
- `gettext`
- `intl`
- `mysqli`
- `pcntl`
- `pdo_mysql`
- `soap`
- `sockets`
- `sysvmsg`
- `sysvsem`
- `sysvshm`
- `opcache`
- `zip`
- **Default extensions** are the default extensions available with the PHP application.
- **Required extensions** are installed automatically and cannot be removed
meker12 marked this conversation as resolved.
Show resolved Hide resolved
- **Optional extensions**–You can install and remove these extensions as needed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Optional extensions**–You can install and remove these extensions as needed
- **Optional extensions**–You can install and remove these extensions as needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed these updates and reverted to original headings from the nested list.


- 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`
| Default extensions | Required extensions | Optional extensions |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required Extension list has been repeated in the Default Extensions list
Also as the Optional list is much longer that the other, the DE & RE list float in the middle of the table. Can these be aligned to the top?

Copy link
Contributor Author

@meker12 meker12 Sep 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Redid the table to begin with required extensions, followed by default and optional extensions. I also removed the default extensions from the optional list, and updated the Optional descriptions summary to state that the default extensions can be disabled.-

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid the list is still incorrect.
The following extensions are required but appear in the optional list -
bcmath
gd
intl
pdo_mysql
soap
xsl
zip

(https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sockets extension also became required in Magento 2.4.0 and higher btw. Should also be included in https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html in my opinion!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hostep I updated the PHP settings topic to add a note about the ext-sockets extension that was in the 2.3 version of the topic:

If you install Magento via cloning from the [GitHub](https://github.com/magento/magento2) repository, then make sure you have the [ext-sockets](https://github.com/php-amqplib/php-amqplib/blob/master/CHANGELOG.md#281---2018-11-13) extension installed on your instance.

In the php-settings topic, the list of required extensions is generated in this file: https://github.com/magento/devdocs/blob/master/src/_includes/install/php-extensions-template.md, but ext-sockets is not included. I think we should open a separate issue to address this, and request assistance from @dshevtsov.

Copy link
Contributor Author

@meker12 meker12 Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid the list is still incorrect.
The following extensions are required but appear in the optional list -
bcmath
gd
intl
pdo_mysql
soap
xsl
zip

(https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements-tech.html)

I restored the original content from this topic. I realized that I was conflating enable and disable extensions with install and uninstall. In the .magento.app.yaml file, which is the subject of this topic, you only enable and disable extensions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meker12: we already kind-of had an issue for this, but it was closed unfortunately: #7568 (comment), should I create a new issue for this? I know colleagues of yours are already aware of the issue for many months (internal ticket DOC-80), but maybe we need an official public ticket to track this, otherwise it might be forgotten...

Copy link
Contributor Author

@meker12 meker12 Sep 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hostep Thanks for the context about the ext-sockets extension. It's useful that the current guide now includes a specific mention of the ext-sockets extension, and why you need it. Will follow up on our internal ticket to understand the best information to provide about this extension.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hostep the DOC-80 is closed. It was mostly focused on the Packages topics. As it appeared, it's impossible to get accurate information about PHP versions from the Composer files. I hope that it is still possible for the list of extensions. Please open an issue for this with your recent suggestions (#7568, #7398) and assign it to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dshevtsov, done: #7960 (but I can't assign you)

|--------------------|---------------------|---------------------|
| `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> | `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> | `bcmath`<br> `bz2`<br> `calendar`<br> `exif`<br> `gd`<br> `geoip`<br> `gettext`<br> `gmp`<br> `igbinary`<br> `imagick`<br> `imap`<br> `intl`<br> `ioncube`<br> `ldap`<br> `mailparse`<br> `mcrypt`<br> `msgpack`<br> `mysqli`<br> `oauth`<br> `opcache`<br> `pdo_mysql`<br> `propro`<br> `pspell`<br> `raphf`<br> `recode`<br> `redis`<br> `shmop`<br> `soap`<br> `sockets`<br> `sodium`<br> `ssh2`<br> `sysvmsg`<br> `sysvsem`<br> `sysvshm`<br> `tidy`<br> `xdebug`<br> `xmlrpc`<br> `xsl`<br> `yaml`<br> `zip`<br> `pcntl`<br> |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is best to clarify here. I don't know why any extension from the Required column would be duplicated anywhere else because you note that they cannot be removed.

Copy link
Contributor Author

@meker12 meker12 Sep 28, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored original column headings. My proposed updates didn't make sense.


{:.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).
36 changes: 30 additions & 6 deletions src/cloud/project/magento-app-php-ini.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,46 @@ 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
To increase the PHP memory limit, add the following setting to the php.ini file:
meker12 marked this conversation as resolved.
Show resolved Hide resolved

```php
memory_limit = 756M
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our support site is recommending something different. Is 756 the minimum? I know I have seen different values for this, and mine is set to 2G.
https://support.magento.com/hc/en-us/articles/360034599631-PHP-settings-errors

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no recommended minimum, this has been discussed many times before, 768M and 2G are ridiculously high. We are running M2 shops on 192M or 256M without issues.

```

For a list of recommended PHP configuration settings, see [Required PHP settings]({{ site.baseurl }}/guides/v2.3/install-gde/prereq/php-settings.html).
## Optimize realpath_cache configuration

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

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

;
; Increase realpath cache ttl
;
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.

{:.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
27 changes: 26 additions & 1 deletion src/guides/v2.4/install-gde/prereq/php-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,23 @@ PHP Warning: date(): It is not safe to rely on the system's timezone settings.
- Installing and updating Magento components from Magento Marketplace, `2G`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be removed now that the web set up wizard was removed in Magento 2.4.0?

- Testing, `~3-4G`

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

```conf
realpath_cache_size=1M
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.

We recommend you enable the [PHP OPcache](https://www.php.net/manual/en/book.opcache.php){:target="_blank"} for performance reasons. The OPcache is enabled in many PHP distributions.

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,6 +145,7 @@ 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.

For example,
Expand All @@ -144,7 +154,22 @@ To set PHP options:
memory_limit=2G
```

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

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

;
; 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
9 changes: 9 additions & 0 deletions src/guides/v2.4/performance-best-practices/software.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ To guarantee successful execution of all Magento instances without dumping data

`memory_limit=768MB`

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

```bash
meker12 marked this conversation as resolved.
Show resolved Hide resolved
realpath_cache_size=1M
realpath_cache_ttl=7200
```

#### ByteCode

To get maximum speed out of Magento 2 on PHP 7, you must activate the OpCache module and properly configure it. These settings are recommended for the module:
Expand Down