PHP之斯马特y学习起名

/*下边那加如若不加会报告错误:

启动Redis

[root@localhost redis-3.0.7]# src/redis-server
14891:C 27 Apr 13:10:08.132 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
14891:M 27 Apr 13:10:08.132 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 14891
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

14891:M 27 Apr 13:10:08.134 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
14891:M 27 Apr 13:10:08.134 # Server started, Redis version 3.0.7
14891:M 27 Apr 13:10:08.134 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
14891:M 27 Apr 13:10:08.134 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
14891:M 27 Apr 13:10:08.135 * DB loaded from disk: 0.001 seconds
14891:M 27 Apr 13:10:08.135 * The server is now ready to accept connections on port 6379

2.建立templates,templates_c,configs,cache目录

测试Redis

在XShell,打开1个新的终极标签

[root@localhost ~]# ls
anaconda-ks.cfg  redis-3.0.7  redis-3.0.7.tar.gz
[root@localhost ~]# cd redis-3.0.7
[root@localhost redis-3.0.7]# src/redis-cli
127.0.0.1:6379> KEYS *
1) "user:1"
2) "test"
3) "Manager"
4) "name"
127.0.0.1:6379> 

3.确立测试页面:index.php

关闭Redis

Redis命令行下

[root@localhost redis-3.0.7]# src/redis-cli
127.0.0.1:6379> shutdown

非Redis命令行下

[root@localhost redis-3.0.7]# src/redis-cli shutdown

//$tpl在main.php中定义

安转Redis

以下配置,暗中认可用户都未到位,就算已经形成,再度实施不会有震慑。

*/
session_start();//开启session
include “libs/Smarty.class.php”;
define(‘__SITE_ROOT’, ‘E:/PHPnow-1.5.1/vhosts/xxh.com’); //
最终没有斜线
$tpl = new Smarty();
$tpl->template_dir = __SITE_ROOT . “/templates/”;
$tpl->compile_dir = __SITE_ROOT . “/templates_c/”;
$tpl->config_dir = __SITE_ROOT . “/configs/”;
$tpl->cache_dir = __SITE_ROOT . “/cache/”;
$tpl->left_delimiter = ‘<{‘;
$tpl->right_delimiter = ‘}>’;
?>

加载插件gcc

[root@localhost ~]# yum gcc

6.打开index.php即能够测试Smarty了.

配置XShell

开拓XShell,点击对话->新建,弹窗如图
起名 1
输入名称,自个儿随便起名,那里小编起名CentOSMini。
长机框输入,查询到的CentOSMini的inet地址。
端口号,默许22,如若端口被挤占或者造成连日战败。
点击用户身份验证,输入CentOSMini的账户和密码
起名 2
配置达成,尝试连接。假使连接退步,请自行排查原因。
暗许连接成功,开头设置Redis。

$tpl->assign(“title”, “测试用的网页标题”);
$tpl->assign(“content”, “测试用的网页内容”);
// 上边两行也能够用那行代替
// $tpl->assign(array(“title” => “测试用的网页标题”, “content”
=> “测试用的网页内容”));
$tpl->display(‘Index.htm’);
?>

动用XShell远程连接CentOSMini

点击download下载XShell5.0。
下载之后安装。配置XShell。

参照网络上的资料,使用斯Matty能够简单的测试:

布置XShell前的备选

开拓VM,运转CentOSMini。CentOSMini运维未来进入Terminal。

[root@localhost ~]# ip addr

输入指令ip addr ,回车查看inet地址。

切换回Windows,打开CMD,输入指令ipconfig,回车查看IPv4地址。

>ipconfig

比对五个ip地址是还是不是在同一IP段,即IP地址格局如{1}.{2}.{3}.{4},比对1,2,3有的是还是不是相同,相同即为同一IP段,此为XShell连通虚拟机安装的CentOSMini的前提。

不精晓怎么

加载插件wget

[root@localhost ~]# yum wget

1.解压斯玛特y到网站目录下,比如起名libs.

下载及安装Redis

Redis安装包网址
新式的安装包为redis-3.0.7.tar.gz

[root@localhost ~]#wget http://download.redis.io/releases/redis-3.0.7.tar.gz
[root@localhost ~]#tar zxvf redis-3.0.7.tar.gz
[root@localhost ~]# cd redis-3.0.7
[root@localhost redis-3.0.7]# make MALLOC=libc

<html>
  <head>
  <meta http-equiv=”Content-Type” content=”text/html;
charset=gb2312″>
  <title><{$title}></title>
  </head>
  <body>
  <{$content}>
  </body>
  </html>

退出Redis命令行

[root@localhost redis-3.0.7]# src/redis-cli
127.0.0.1:6379> quit
[root@localhost redis-3.0.7]# 

4.在templates下树立模板文件index.htm

<?php
require “main.php”;

<?php

Notice: Undefined variable: _SESSION in
E:\PHPnow-1.5.1\vhosts\xxh.com\libs\Smarty.class.php on line
585

5.建立main.php

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图