欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法_PHP教程

程序员文章站 2024-01-11 20:19:04
...
做开发的时候,操作session有时候会遇到这个问题:Warning: session_start() [function.session-start]……

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,问题解决!

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/764622.htmlTechArticle做开发的时候,操作session有时候会遇到这个问题:Warning: session_start() [function.session-start]…… PHP环境: OS:CentOS release 5.2 (Final) Apache: Server...