PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法_PHP教程
程序员文章站
2024-01-11 20:19:04
...
做开发的时候,操作session有时候会遇到这个问题:Warning: session_start() [function.session-start]……
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
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,问题解决!
上一篇: 【力扣】11. 盛最多水的容器
下一篇: Photoshop 人物裙子加上花纹图案
推荐阅读
-
Cannot modify header information错误解决方法_PHP教程
-
CodeIgniter错误mysql_connect(): No such file or directory解决方法,nosuchfile_PHP教程
-
PHP 编码错误不显示错误信息提示解决方法_PHP教程
-
PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法_PHP教程
-
PHP错误Warning:mysql_query()解决方法,warningmysql_query
-
完美解决phpdoc导出文档中@package的warning及Error的错误,_PHP教程
-
PHP错误WARNING: SESSION_START() [FUNCTION.SESSION-START]解决方法
-
为PHP安装imagick时出现Cannot locate header file MagickWand.h错误的解决方法,imagick_PHP教程
-
phpExcel导出大量数据出现内存溢出错误的解决方法_PHP教程
-
PHP新手NOTICE错误常见解决方法_PHP教程