PHP, web geliştirmenin temel taşlarından biridir ve WordPress, Laravel, Symfony gibi popüler framework'lerin temelidir. Bu rehberde PHP performansını artırma, güvenlik önlemleri ve en iyi uygulamaları öğreneceksiniz.
PHP Sürümleri ve Performans
| Sürüm | Performans | Destek Sonu | Önerilen |
|---|---|---|---|
| PHP 8.3 | En hızlı, JIT iyileştirmeleri | 2027 | ✅ Önerilir |
| PHP 8.2 | Çok hızlı | 2026 | ✅ Stabil |
| PHP 8.1 | Hızlı, Fibers desteği | 2025 | ⚠️ Güncelle |
| PHP 7.4 | Orta | Sona erdi | ❌ Güncelle |
php.ini Optimizasyonu
# Performans ayarları
memory_limit = 256M
max_execution_time = 60
max_input_time = 60
upload_max_filesize = 64M
post_max_size = 64M
# OPcache (mutlaka açık olmalı)
opcache.enable = 1
opcache.memory_consumption = 256
opcache.max_accelerated_files = 20000
opcache.validate_timestamps = 0 # Üretimde 0, geliştirmede 1
opcache.revalidate_freq = 0
opcache.interned_strings_buffer = 32
# JIT Compiler (PHP 8.0+)
opcache.jit = 1255
opcache.jit_buffer_size = 128M
# Realpath cache
realpath_cache_size = 4096K
realpath_cache_ttl = 600PHP-FPM Yapılandırma
# /etc/php/8.3/fpm/pool.d/www.conf
# Dinamik process yönetimi
pm = dynamic
pm.max_children = 50 # max PHP process
pm.start_servers = 10 # başlangıçta
pm.min_spare_servers = 5 # minimum boşta
pm.max_spare_servers = 15 # maximum boşta
pm.max_requests = 1000 # memory leak önleme
# Slow log (yavaş script tespiti)
slowlog = /var/log/php-fpm-slow.log
request_slowlog_timeout = 5s
request_terminate_timeout = 60sGüvenlik Ayarları
# Tehlikeli fonksiyonları devre dışı bırak
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec
# Hata gösterimini kapa (üretimde)
display_errors = Off
log_errors = On
error_log = /var/log/php_errors.log
# Session güvenliği
session.cookie_httponly = On
session.cookie_secure = On
session.use_strict_mode = On
session.cookie_samesite = Strict
# X-Powered-By headerını gizle
expose_php = OffComposer ile Bağımlılık Yönetimi
# Composer kurulumu
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Proje oluşturma
composer create-project laravel/laravel proje-adi
# Üretim için optimize
composer install --no-dev --optimize-autoloader
composer dump-autoload --optimize --classmap-authoritativeWordPress performans rehberimizde PHP optimizasyonunun site hızına etkisini detaylı anlattık.
PHP destekli hosting paketleri için Web Hosting sayfamızı ziyaret edin.

