PHP Ayarlarını Değiştirme
ServBay, kendi PHP ortamını içerir ve esnek yapılandırma seçenekleri sunar. Bu makale, ServBay içinde PHP ayarlarını nasıl değiştireceğinizi, php.ini
ve php-fpm.conf
dosyalarının konumlarını ve yaygın yapılandırma öğelerini detaylı bir şekilde açıklayacaktır. PHP sürümüne bağlı olarak, bu dosyalar /Applications/ServBay/etc/php/<version>
dizinindedir. Ayrıca, PHP modül yükleme yapılandırma dosyaları (örneğin xdebug.ini
) /Applications/ServBay/etc/php/<version>/conf.d
dizininde bulunur.
Genel Bakış
ServBay içinde, PHP yapılandırma dosyaları sürüme göre farklı dizinlerde bulunur. Örneğin, PHP 8.3 yapılandırma dosyaları /Applications/ServBay/etc/php/8.3
dizinindedir. İşte bu yapılandırma dosyalarının detaylı konumları:
php.ini
:/Applications/ServBay/etc/php/8.3/php.ini
php-fpm.conf
:/Applications/ServBay/etc/php/8.3/php-fpm.conf
- PHP modül yükleme yapılandırma dosyaları:
/Applications/ServBay/etc/php/8.3/conf.d/
php.ini Yapılandırması
php.ini
dosyası, PHP'nin ana yapılandırma dosyasıdır ve PHP'nin çeşitli çalışma zamanı seçeneklerini ayarlamak için kullanılır.
Yaygın Yapılandırma Öğeleri
Aşağıda bazı yaygın php.ini
yapılandırma öğeleri ve bunların nasıl değiştirileceği yer almaktadır:
Bellek sınırını değiştirme:
memory_limit = 256M
1Yüklenen dosya boyutu sınırını değiştirme:
upload_max_filesize = 50M post_max_size = 50M
1
2Saat dilimini ayarlama:
date.timezone = "Asia/Hong_Kong"
1Hata gösterimini etkinleştirme:
display_errors = On error_reporting = E_ALL
1
2Maksimum yürütme süresini değiştirme:
max_execution_time = 300
1
php-fpm.conf Yapılandırması
php-fpm.conf
dosyası, PHP-FPM (FastCGI Process Manager) çalışma parametrelerini yapılandırmak için kullanılır.
Yaygın Yapılandırma Öğeleri
Aşağıda bazı yaygın php-fpm.conf
yapılandırma öğeleri ve bunların nasıl değiştirileceği yer almaktadır:
İşlem havuzu ayarlarını değiştirme:
[www] listen = /Applications/ServBay/tmp/php-cgi-8.3.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 ;listen.owner = www ;listen.group = www listen.mode = 0666 ;user = www ;group = www pm = dynamic pm.max_children = 10 pm.start_servers = 2 pm.min_spare_servers = 1 pm.max_spare_servers = 6 pm.max_requests = 1024 pm.process_idle_timeout = 10s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16Yavaş günlük kaydını etkinleştirme:
request_slowlog_timeout = 5s slowlog = /Applications/ServBay/logs/php/8.3/slow.log
1
2Hata günlüğünün yolunu değiştirme:
error_log = /Applications/ServBay/logs/php/8.3/errors.log
1
PHP Modül Yükleme Yapılandırması
PHP modül yükleme yapılandırma dosyaları /Applications/ServBay/etc/php/8.3/conf.d/
dizinindedir. Örneğin, xdebug.ini
dosyası Xdebug uzantısını yapılandırmak için kullanılır.
xdebug.ini Örneği
Aşağıda bir xdebug.ini
dosyası örneği bulunmaktadır:
[Xdebug]
; Uncomment the following line to enable XDebug
zend_extension = xdebug.so
xdebug.mode=debug,develop
xdebug.start_with_request=yes
xdebug.client_host=localhost
xdebug.client_port=39083
xdebug.log=/Applications/ServBay/logs/xdebug/8.3/xdebug.log
2
3
4
5
6
7
8
PHP'yi Yeniden Başlatma
PHP yapılandırma dosyalarını değiştirdikten sonra, değişikliklerin geçerli olabilmesi için PHP hizmetini yeniden başlatmanız gerekir. Bu işlemi ServBay yönetim arayüzü veya servbayctl
komut satırı aracı ile yapabilirsiniz.
ServBay Yönetim Arayüzü ile Yeniden Başlatma
- ServBay yönetim arayüzünü açın.
Hizmetler
navigasyonuna gidin.- İlgili PHP sürüm hizmetini bulun ve
Yeniden Başlat
düğmesine tıklayın.
servbayctl ile Yeniden Başlatma
servbayctl
komut satırı aracı ile PHP hizmetini kolayca yeniden başlatabilirsiniz:
servbayctl restart php 8.3
Özet
ServBay içinde PHP yapılandırma dosyaları /Applications/ServBay/etc/php/<version>
dizininde bulunur, php.ini
ve php-fpm.conf
dahil. PHP modül yükleme yapılandırma dosyaları /Applications/ServBay/etc/php/<version>/conf.d/
dizinindedir. Bu yapılandırma dosyalarını değiştirdikten sonra, değişikliklerin geçerli olabilmesi için PHP hizmetini ServBay yönetim arayüzü veya servbayctl
komut satırı aracı ile yeniden başlatabilirsiniz.