memcached:无法解析session.save_path

时间:2018-09-14 14:14:55

标签: php memcached

我正在尝试设置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 

我该怎么做才能解决此问题?

0 个答案:

没有答案