PHP 5.3 ve oturumları klasör ile sorunlar

3 Cevap php

I recently upgraded to PHP 5.3 and since then I get (sporadic) error messages which indicate Apache (or may be the cleaner of the session files) has no permissions to the folder where the sessions are stored.
This happens randomly and can't be reproduced with exact steps, which led me to guess it is the session cleaner.
Any one has any experience with such errors?

(session_start() hattı üzerinde ateş) hata iletisi:

ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied.

Oturum dizinde ls-lt'ye verir:

drwx-wx-wt  2 root          root          4096 2010-05-25 12:39 php5

Inside this directory I do see session files owned by www-data which is my Apache, and the app does work fine. Which makes me wonder, under which user does the session GC runs?

3 Cevap

The fix: da php.ini grubu içinde session.gc_probability ile 0

The cause I believe I found the answer here http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage

Esasen, çöp toplama bazı sistemlerde (yani Ubuntu / Debian) cron işleri tarafından yapılması için kuruldu. Php-cli gibi bazı php ini yürütülebilir çöp toplama yapmaya çalışın ve size var hatayla sonuçlanır.

Bu (Ben Lucid LTS kullanıyorum) Ubuntu sunucuları üzerinde tipik bir hata olduğu görünüyor. / Var/lib/php5 dizinin varsayılan izinleri vardır drwx-wx-wt 2 root root 4096 2011-11-04 02:09 php5 - bu yüzden yazılmış ama web sunucusu tarafından okuyamıyor olabilir, ben bu hataları açıklıyor sanırım.

Ubuntu var gibi (/ etc/cron.d/php5), bu Diwant Vaidya yukarıda önerilen gibi php çöp toplama devre dışı bırakmak için muhtemelen en iyi cron'nun yoluyla kendi çöp temizleme bulunuyor.

Oturum klasör dünya okunamamalıdır bir sebebi aslında var - PHP Manual dediği gibi:

If you leave this set to a world-readable directory, such as /tmp (the default), other users on the server may be able to hijack sessions by getting the list of files in that directory.

Şu anda (ki ben emin değilim doğru olanı) kullanmak çözüm Apache kullanıcı (benim durumumda www-data) için oturum klasörüne sahipliğini vermektir.