# PHP Cache Related Issues

The php-fpm configuration for production servers is and should be optimized to use the various caching options. With PHP 7.x and above, there have been a number of improvements, most notably with the introduction of the new file cache. See [here](https://patrickkerrigan.uk/blog/php-opcache-file-cache/) for a brief overview.

However, these new features have side effects: For example, after deploying, you may find that source changes have not taken effect on your server.

### Ignoring Timestamps

In most cases, the cause of these issues is related to the&#x20;

```
opcache.validate_timestamps
```

configuration value. For performance reasons, Shopware recommends to disable it on production servers. See [here](https://developer.shopware.com/docs/guides/hosting/performance/performance-tweaks.html#php-config-tweaks) for details.

### Reset Cache After Deployment

The easiest and safest way to completely reset opcache is to use the famous [cachetool](https://github.com/gordalina/cachetool). Just request it with composer in your environment:

```
composer require gordalina/cachetool
```

Then, assuming your server is equipped with php-fpm, resetting opcache is as simple as running the following command:

```
vendor/bin/cachetool opcache:reset --fcgi=/var/run/php-fpm.sock
```

Note that the value of --fcgi depends on your actual web server setup.

### ddev and other Local Environments

In local environments, just make sure that opcache file timestamps are always validated by adding the following directive to your php ini file:

```
opcache.validate_timestamps = 1
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notebook.vanwittlaer.de/deployment/php-cache-related-issues.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
