做开发的时候,操作session有时候会遇到这个问题:Warning: session_start() [function.session-start]……
系统环境:WIN2003+IIS6+PHP5.2.12
PHP出现类似如下错误: Warning: session_start()[function.session-start]: ...... Failed: No such file or directory......等情况, 可以偿试修改一下PHP.ini文件中的session.auto_start = 0 改为 session.auto_start = 1 如果重启IIS后问题依然存在, 那就是session变量需要系统的临时文件空间,并需要读写的权限。 在PHP.ini里找到session.save_path =,设置一个有效的文件夹路径, 例如:session.save_path = "c:\PHP5\session_temp" 并添加该文件夹的权限,让everyone有修改写入的权限即可。
PHP环境:
OS:CentOS release 5.2 (Final) Apache: Server version: Apache/2.2.3 Server built: Jan 15 2008 20:33:30 PHP: PHP 5.1.6 (cli) (built: May 24 2008 14:07:53) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0,Copyright (c) 1998-2006 Zend Technologies报错信息如下:
代码如下:
PHP/session/sess_itqfqua1554rmkgcb8u89ujem5,O_RDWR)Failed:Permission denied(13)in www_path on line 9
Warning:Unknown:open(/var/lib/PHP/session/sess_itqfqua1554rmkgcb8u89ujem5,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.sav_path is correct (/var/lib/PHP/session)in Unknown on line 0