PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法_php技巧
系统环境: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
报错信息如下:
Warning:session_start()[function.session-start]:open(/var/lib/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
解决办法:
方法1、注释掉/etc/php.ini中
session.save_path = “/var/lib/php/session”
方法2、查看apache用户和组,然后将该用户加到session文件夹所处的组中。
方法3,在session_start() 前不要有任何输出!
然后重启Apache;
OK,问题解决!
推荐阅读
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
php session_start()关于Cannot send session cache limiter - headers already sent错误解决方法
-
PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法
-
PHP错误Warning:mysql_query()解决方法
-
Warning: session_destroy() : Trying to destroy uninitialized sessionq错误_php技巧
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
Warning: session_start() [function.session-start]: open_base_PHP教程
-
setcookie中Cannot modify header information-headers already sent by错误的解决方法详解_php技巧
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法
-
PHP错误Warning: Cannot modify header information - headers already sent by解决方法_php实例