memcached 配置 config
- font size decrease font size increase font size
- Print Email
启动memcached
# service memcachedstart
启动memcached
# service memcachedstart
设置memcached自动启动
# chkconfig memcached on
memcached 配置文件
memcached 配置文件
#memcached 监听端口号
PORT="11211"
#memcached启动用户
USER="nobody"
# 最大并发链接数
MAXCONN="2048"
# memcached 启动后分配内存大小
CACHESIZE="4096"
# memcached启动的其它参数, memcached 监听的ip地址,只监听本机使用127.0.0.1
OPTIONS="-l 127.0.0.1"
安装php的memcached扩展包
# yum install php-pecl-memcache
使用下面测试例子测试
$memcache = new Memcache;
$memcache->connect('localhost', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."
\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 10 seconds)
\n";
$get_result = $memcache->get('key');
echo "Data from the cache:
\n";
var_dump($get_result);
?>
( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0020 | 412184 | {main}( ) | .../index.php:0 |
2 | 0.0885 | 4262136 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0885 | 4262136 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.4526 | 11452984 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.4536 | 11477296 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.4546 | 11532624 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.4550 | 11560024 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.4662 | 11959656 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.4662 | 11959656 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.4768 | 12610360 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.4768 | 12610360 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.4810 | 12981400 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.4826 | 13001768 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.5470 | 15778536 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.5470 | 15778536 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.5488 | 15951472 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |
- Published in CentOS 6
- Read 4407 times
( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478 | ||||
---|---|---|---|---|
Call Stack | ||||
# | Time | Memory | Function | Location |
1 | 0.0020 | 412184 | {main}( ) | .../index.php:0 |
2 | 0.0885 | 4262136 | Joomla\CMS\Application\SiteApplication->execute( ) | .../index.php:49 |
3 | 0.0885 | 4262136 | Joomla\CMS\Application\SiteApplication->doExecute( ) | .../CMSApplication.php:196 |
4 | 0.4526 | 11452984 | Joomla\CMS\Application\SiteApplication->dispatch( ) | .../SiteApplication.php:233 |
5 | 0.4536 | 11477296 | Joomla\CMS\Component\ComponentHelper::renderComponent( ) | .../SiteApplication.php:194 |
6 | 0.4546 | 11532624 | Joomla\CMS\Component\ComponentHelper::executeComponent( ) | .../ComponentHelper.php:377 |
7 | 0.4550 | 11560024 | require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ) | .../ComponentHelper.php:402 |
8 | 0.4662 | 11959656 | K2ControllerItem->execute( ) | .../k2.php:64 |
9 | 0.4662 | 11959656 | K2ControllerItem->display( ) | .../BaseController.php:710 |
10 | 0.4768 | 12610360 | K2ControllerItem->display( ) | .../item.php:78 |
11 | 0.4768 | 12610360 | K2ControllerItem->display( ) | .../controller.php:19 |
12 | 0.4810 | 12981400 | Joomla\CMS\Cache\Controller\ViewController->get( ) | .../BaseController.php:663 |
13 | 0.4826 | 13001768 | K2ViewItem->display( ) | .../ViewController.php:102 |
14 | 0.5470 | 15778536 | K2ViewItem->display( ) | .../view.html.php:742 |
15 | 0.5470 | 15778536 | K2ViewItem->loadTemplate( ) | .../HtmlView.php:230 |
16 | 0.5488 | 15951472 | include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ) | .../HtmlView.php:701 |