簡體   English   中英

php會話保存在ramdisk中

[英]php sessions saved in ramdisk

我正在嘗試在ramdisk上保存我的php會話。 我有一個權限問題,但我看不出它是什么問題。

  1. 我有ramdisk:

    /dev/ram0 407M 2.4M 404M 1% /var/lib/php/session/ramd

  2. 我有權限:

    drwxrwx---. 3 root apache 1024 Mar 24 01:53 ramd

  3. 我的錯誤:

    Warning: session_start(): open(/var/lib/php/session/ramd/sess_b0ko6hl3p6ojj2ot3qfqvm9km1, O_RDWR) failed: Permission denied (13) in /var/www/html/index.php on line 3 Warning: Unknown: open(/var/lib/php/session/ramd/sess_b0ko6hl3p6ojj2ot3qfqvm9km1, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session/ramd) in Unknown on line 0

  4. 在php.ini中,session.save_path變量設置為"/var/lib/php/session"

  5. 在我的腳本中,我將session.save_path設置為"var/lib/php/session/ramd"

如果我創建了我創建的ramdisk,我可以將我的會話保存在/ rand文件夾中。 它我坐...我不能。 我也試過chmod root:root / apache:apache with chmod 0777 1777.現在它是0770。

我使用:CentOS 6.4,PHP 5.3.3,Apache / 2.2.15

任何人都可以幫我解決這個問題嗎?

LE:

[root@localhost ~]# ps aux | grep apache
apache    2355  0.0  0.4 394868  7840 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2356  0.0  0.4 394876  7844 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2357  0.0  0.4 394876  7824 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2358  0.0  0.4 394876  7816 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2360  0.0  0.4 394876  7900 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2361  0.0  0.4 394876  7800 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2362  0.0  0.4 394876  7844 ?        S    01:53   0:00 /usr/sbin/httpd
apache    2363  0.0  0.4 394868  7716 ?        S    01:53   0:00 /usr/sbin/httpd
root      3119  0.0  0.0 103248   868 pts/0    S+   02:52   0:00 grep apache

[root@localhost ~]# ps aux | grep php
root      3132  0.0  0.0 103244   868 pts/0    S+   02:54   0:00 grep php

執行以下操作以查看SELinux是否處於強制執行模式:

# sestatus

如果是這樣,您可能想嘗試通過以root身份運行以下(或使用sudo)來禁用SELinux:

# setenforce 0

這將使SELinux停止執行任何策略。 如果這樣可以解決問題,則必須關閉SELinux或擴充策略以允許此新路徑正確運行。 如果確實達到了這一點,請參考https://serverfault.com/a/323528/165777以獲取有關如何執行該步驟的一些信息!

此外,如果這沒有產生影響和/或您想重新啟用SELinux,請執行:

# setenforce 1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM