Switching the Profiler Storage
Edit this pageWarning: You are browsing the documentation for Symfony 2.5, which is no longer maintained.
Read the updated version of this page for Symfony 6.3 (the current stable version).
Switching the Profiler Storage
By default the profile stores the collected data in files in the cache directory.
You can control the storage being used through the dsn
, username
,
password
and lifetime
options. For example, the following configuration
uses MySQL as the storage for the profiler with a lifetime of one hour:
1 2 3 4 5 6 7
# app/config/config.yml
framework:
profiler:
dsn: "mysql:host=localhost;dbname=%database_name%"
username: "%database_user%"
password: "%database_password%"
lifetime: 3600
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:framework="http://symfony.com/schema/dic/symfony"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony
http://symfony.com/schema/dic/symfony/symfony-1.0.xsd"
>
<framework:config>
<framework:profiler
dsn="mysql:host=localhost;dbname=%database_name%"
username="%database_user%"
password="%database_password%"
lifetime="3600"
/>
</framework:config>
</container>
1 2 3 4 5 6 7 8 9 10 11
// app/config/config.php
// ...
$container->loadFromExtension('framework', array(
'profiler' => array(
'dsn' => 'mysql:host=localhost;dbname=%database_name%',
'username' => '%database_user',
'password' => '%database_password%',
'lifetime' => 3600,
),
));
The HttpKernel component currently supports the following profiler storage implementations: