最新消息: 新版网站上线了!!!

PHP出现 Warning: session_start() [function.session-start]: open

我的php出现 session问题当我编辑一个名字为session.php的程序其内容 " S+ C% e. O! p5 ^5 V

<?php 
session_start(); 
$_SESSION[test]="test"; 
echo $_SESSION[test]; 
echo "<a href="/222.php">222.php</a>"; 
?>

但当我在浏览器里浏览时出现
Warning: session_start() [function.session-start]: open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in E:\web\htdocs\111.php on line 9 
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9 
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at E:\web\htdocs\111.php:8) in E:\web\htdocs\111.php on line 9 
test222.php 
Warning: Unknown(): open(/tmp\sess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) 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 (/tmp) in Unknown on line 0 

这个是session的tmp路径没有设置的缘故
你在php,ini的session.save_path设置一个路径就可以了,并且这个路径是有效的。比如:c:\winnt\temp

然后到你的c盘下面建一个目录winnt,再在这个目录下面建一个temp目录(如果是在服务器就建在服务器)

最后重启一下apache

转载请注明:谷谷点程序 » PHP出现 Warning: session_start() [function.session-start]: open