烦死了 这个老师真垃圾

烦死了 这个老师真垃圾

只顾自己巴拉巴拉讲,讲的什么,普通话也比标准,我他妈也是醉了,

ini_set('session.save_handle', 'memcached');


//设置session存储memcached服务器端口

ini_set('session.save_path', '192.168.1.103:11211');


//设置cookie名称

ini_set('session.name', 'show_id');


//设置session生存时间

ini_set('session.gc_maxlifetime',3600);


//设置session存储memcached key前缀

ini_set('memcached.sess_prefix', 'memc.show.');


session_start();


<?php


require 'config.php';

if(isset($_SESSION['user_no']) && !empty($_SESSION['user_no'])){

echo "hello {$_SESSION['user_name']} 你已经成功登录";

}else{

if(isset($_GET['user_no']) && intval($_GET['user_no'])==201611){

$_SESSION['user_no']=intval($_GET['user_no']);

$_SESSION['user_name']=trim($_GET['user_name']);


$key=ini_get('memcached.sess_prefix').session_id();

echo "恭喜你,{$_SESSION['user_name']},你的key是:{$key}";

}else{

echo '参数错误,请重新输入';

}

}

就是报错 烦死了

Warning: session_start(): open(192.168.1.103:11211/sess_2c1e4e07ba98825c68132d98d7452d85, O_RDWR) failed: No such file or directory (2) in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 18

Warning: session_start(): Failed to read session data: files (path: 192.168.1.103:11211) in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 18
恭喜你,zhangsan,你的key是:memc.imooc.

讲的一点都不详细 听都听不懂 浪费时间 气的一肚子气 

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,报错信息:1、 警告:session_start(): open(192.168.1.103:11211/sess_2c1e4e07ba98825c68132d98d7452d85, O_RDWR)失败:没有这样的文件或目录(2) 。2、警告:session_start():读取会话数据失败:文件(路径:192.168.1.103:11211)。没有找到相应的文件。

同学并没有成功将session存储的介质修改为memcached。修改代码:

<?php
//设置session存储介质 为memcached
// save_handler 并不是save_handle
ini_set('session.save_handler', 'memcached');

//设置session存储memcached服务器端口
ini_set('session.save_path', '192.168.1.103:11211');

//设置cookie名称
ini_set('session.name', 'show_id');

//设置session生存时间
ini_set('session.gc_maxlifetime',3600);

//设置session存储memcached key前缀
ini_set('memcached.sess_prefix', 'memc.show.');

session_start();

祝学习愉快!

  • 消除bug 提问者 #1
    Warning: session_start(): Failed to write session lock: CONNECTION FAILURE in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to write session lock: CONNECTION FAILURE in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to write session lock: CONNECTION FAILURE in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to write session lock: CONNECTION FAILURE in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to write session lock: CONNECTION FAILURE in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to write session lock: SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Unable to clear session lock record in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 Warning: session_start(): Failed to read session data: memcached (path: 192.168.1.103:11211) in /var/www/lamp.imooc.com/public_html/memcached/sess/config.php on line 22 恭喜你,zhangsan,你的key是:memc.show. 我能说换成这个代码报的错误更多了吗
    2019-08-11 14:00:15
  • 好帮手慕小尤 回复 提问者 消除bug #2
    同学你好,错误信息:警告:session_start():写入会话锁失败:连接失败。同学的目录是否有写的权限。如果没有同学可以为其设置权限(chmod 777 路径)。祝学习愉快!
    2019-08-11 14:35:05
  • 消除bug 提问者 回复 好帮手慕小尤 #3
    能在详细点吗
    2019-08-11 14:38:29
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师