php memcached:无法解析session.save路径

u4vypkhs  于 2023-02-28  发布在  PHP
关注(0)|答案(1)|浏览(93)

我正在尝试设置memcached以使用PHP
我已经安装了它,并确认它可以与php -i | grep memcached一起使用
我正在运行一个简单的php文件来测试memcached:

<?php
session_start();
$_SESSION['some'] = 'thing';
echo session_id()."\n";
print_r($_SESSION);

当我运行它时,我得到一个错误:

Warning: session_start(): failed to parse session.save_path in /Applications/XAMPP/xamppfiles/htdocs/public_html/session/s.php on line 2
PHP Warning:  session_start(): Failed to initialize storage module: memcached (path: tcp://localhost:11211) in /Applications/XAMPP/xamppfiles/htdocs/public_html/session/s.php on line 2
Warning: session_start(): Failed to initialize storage module: memcached (path: tcp://localhost:11211) in /Applications/XAMPP/xamppfiles/htdocs/public_html/session/s.php on line 2

我发现了一个将save_path设置为以下值的建议:
session.save_path="tcp://localhost:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15"
但是误差仍然存在。
这是我的php.ini的一部分

session.save_handler=memcached
session.save_path="tcp://localhost:11211?persistent=1&amp;weight=1&amp;timeout=1&amp;retry_interval=15"

内存缓存部分

Version 3.0.4
libmemcached version    1.0.18
SASL support    yes
Session support yes
igbinary support    no
json support    no
msgpack support no
memcached.compression_factor    1.3 1.3
memcached.compression_threshold 2000    2000
memcached.compression_type  fastlz  fastlz
memcached.default_binary_protocol   0   0
memcached.default_connect_timeout   0   0
memcached.default_consistent_hash   0   0
memcached.serializer    php php
memcached.sess_binary_protocol  1   1
memcached.sess_connect_timeout  0   0
memcached.sess_consistent_hash  1   1
memcached.sess_lock_expire  0   0
memcached.sess_lock_max_wait    not set not set
memcached.sess_lock_retries 5   5
memcached.sess_lock_wait    not set not set
memcached.sess_lock_wait_max    2000    2000
memcached.sess_lock_wait_min    1000    1000
memcached.sess_locking  1   1
memcached.sess_number_of_replicas   0   0
memcached.sess_persistent   0   0
memcached.sess_prefix   memc.sess.  memc.sess.
memcached.sess_randomize_replica_read   0   0
memcached.sess_remove_failed_servers    0   0
memcached.sess_sasl_password    no value    no value
memcached.sess_sasl_username    no value    no value
memcached.sess_server_failure_limit 0   0
memcached.store_retry_count 2   2

端口11211打开:

$netstat -ap tcp | grep -i "listen"
tcp4       0      0  *.11211                *.*                    LISTEN     
tcp6       0      0  *.11211                *.*                    LISTEN

我应该怎么做才能解决这个问题?

cngwdvgl

cngwdvgl1#

我在php 8.1和memcached 3.2.0下只告诉服务器IP和端口就解决了完全相同的问题:

session.save_handler=memcached
session.save_path="MEMCACHED_SERVER_IP:11211"

此致,

相关问题