Pesan "Empty search results" pada URL /_profiler/ Symfony terjadi ketika Profiler Storage gagal merekam, mengindeks, atau membaca metadata token request dari direktori penyimpanan profil (biasanya di var/cache/dev/profiler/ atau SQLite storage). Masalah ini dipicu oleh tiga faktor utama: profiler dinonaktifkan di konfigurasi environment, permission folder cache terkunci oleh user sistem yang berbeda, atau header response X-Debug-Token terhalang oleh reverse proxy/CORS.
Untuk mengembalikan rekaman request secara instan, bersihkan cache dan perbaiki permission kepemilikan folder cache development menggunakan perintah berikut di terminal server Anda:
# 1. Hapus cache dev yang korup
php bin/console cache:clear --env=dev
# 2. Berikan hak akses penuh ke user web server (misal www-data atau nginx)
HTTPDUSER=$(ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX varPenyebab Utama dan Matriks Solusi Profiler Kosong
Ketika pencarian di halaman /_profiler/ tidak menampilkan daftar HTTP request sama sekali, verifikasi sumber masalah melalui tabel diagnostik di bawah ini:
| Indikasi Masalah | Penyebab Teknis | File / Lokasi Konfigurasi | Solusi Utama |
|---|---|---|---|
| Pencarian selalu 0 hasil | Profiler collector dimatikan atau diatur hanya saat exception | config/packages/framework.yaml | Ubah collect: true dan only_exceptions: false |
| Request masuk tapi tidak tercatat | Permission folder var/cache/dev/profiler/ read-only | Direktori var/ di server Linux/macOS | Reset ACL / chmod -R 775 var/ ke user web server |
| Toolbar profiler hilang total | Bundle profiler tidak aktif di environment saat ini | config/bundles.php | Pastikan WebProfilerBundle aktif pada key ['dev' => true, 'test' => true] |
| AJAX/API request tidak muncul | Header X-Debug-Token-Link diblokir CORS | Konfigurasi NelmioCors / Nginx | Expose header X-Debug-Token dan X-Debug-Token-Link |
| Storage SQLite terkunci (database locked) | Storage profiler menggunakan DSN file database yang terkunci proses zombie | config/packages/web_profiler.yaml | Hapus file SQLite di var/cache/dev/profiler.db dan restart PHP-FPM |
Verifikasi Konfigurasi Framework dan Web Profiler
Pastikan bundle profiler aktif dan dikonfigurasi untuk menangkap seluruh request HTTP normal, bukan hanya error/exception. Buka file konfigurasi berikut di project Symfony Anda:
1. Cek config/packages/web_profiler.yaml
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler:
only_exceptions: false
collect: trueJika opsi only_exceptions bernilai true, Symfony secara sengaja mengabaikan response dengan status code HTTP 200, 301, atau 302, sehingga halaman pencarian profiler tampak kosong melompong.
2. Cek Konfigurasi Profiler Storage di framework.yaml
Secara default, Symfony menyimpan token profiler dalam sistem file (file-based storage). Jika DSN storage dikustomisasi ke SQLite atau database eksternal dan koneksi terputus, profiler akan gagal membaca index request:
framework:
profiler:
enabled: true
# Gunakan default filesystem storage jika sqlite bermasalah
dsn: 'file:%kernel.cache_dir%/profiler'Troubleshooting Request API / AJAX dan Reverse Proxy (Nginx)
Jika Anda menggunakan frontend terpisah (React, Vue, Next.js, Flutter) atau memanggil API via Fetch/Axios, profiler web Symfony tetap mengumpulkan token profil selama header HTTP diteruskan secara utuh.
1. Ekspos Header di NelmioCorsBundle
Jika CORS aktif, browser akan memblokir pembacaan header debug kecuali diizinkan secara eksplisit pada config/packages/nelmio_cors.yaml:
nelmio_cors:
defaults:
origin_regex: true
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization', 'X-Requested-With']
exposed_headers: ['X-Debug-Token', 'X-Debug-Token-Link']
max_age: 36002. Bypass Header Buffering di Nginx
Jika menggunakan reverse proxy Nginx, pastikan buffer FastCGI tidak memotong response header yang panjang dari PHP-FPM:
location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
# Cegah pemotongan header debug Symfony
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}Prosedur Reset Bersih Profiler Cache
Jika indeks profiler (index.csv) di dalam cache mengalami korupsi data akibat disk penuh atau script abort mendadak, lakukan pembersihan manual secara total:
- Hentikan service web server lokal atau container Docker:
docker compose stopatausudo systemctl stop php-fpm. - Hapus direktori profiler manual:
rm -rf var/cache/dev/profiler/. - Jalankan warming cache ulang:
php bin/console cache:warmup --env=dev. - Kirim 1 request uji coba ke homepage:
curl -I http://localhost:8000/. - Periksa kembali dashboard profiler di browser:
http://localhost:8000/_profiler/. Request uji coba akan langsung muncul di baris teratas hasil pencarian.