Session
Shopware, by default, uses the session storage configured in PHP. On most installations, this is the file system. In smaller setups, you will not need to take care of sessions. However, for larger setups using clustering or with a lot of traffic, you will probably configure alternative session storage, such as Redis, to reduce the load on the database.
By default, Shopware uses the settings configured in PHP. You can reconfigure the Session config directly in your
php.ini
. Here is an example of configuring it directly in PHP.session.save_handler = redis
session.save_path = "tcp://host:6379"
If you don't have access to the php.ini configuration, you can configure it directly in Shopware itself. For this, create a
config/packages/redis.yml
file with the following content:# config/packages/redis.yml
framework:
session:
handler_id: "redis://host:port"
Symfony also provides PHP implementations of some adapters:
To use one of these handlers, you must create a new service in the dependency injection and set the
handler_id
to the service id.Example service definition:
<service id="session.db" class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
<argument ....></argument>
</service>
Example session configuration:
# config/packages/redis.yml
framework:
session:
handler_id: "session.db"
Last modified 4mo ago