Centos7安装LAMP+PHPmyadmin

1、更新Centos7下载源
更新之前记得备份!!!
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
参考:http://mirrors.aliyun.com/help/centos
163的源参考:http://mirrors.163.com/.help/centos.html
2、更新本地缓存
yum clean all
yum makecache
3、安装网络工具
yum install net-tools
如果你要用ifconfig等命令的话
4、关闭firewall
systemctl stop firewalld.service
systemctl disable firewalld.service
5、关闭selinux
vi /etc/selinux/config
注释#SELINUX=enforcing
注释#SELINUXTYPE=targeted
添加SELINUX=disabled
保存退出:wq
setenforce 0#关闭selinux
6、安装apache
yum install httpd
7、安装Mariadb
yum install mariadb mariadb-server
拷贝配置文件覆盖原配置文件
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
8、安装PHP
yum install php php-mysql php-gd php-odbc php-pear php-mbstring php-mcrypt
9、下载PHPmyadmin
wget https://files.phpmyadmin.net/phpMyAdmin/4.0.0/phpMyAdmin-4.0.0-all-languages.zip
解压到/var/www/html/phpmyadmin

10、配置站点
vi /etc/httpd/conf/httpd.conf
文件最后加入

Include vhost/*.conf
mkdir /etc/httpd/vhost
touch test.conf

DocumentRoot /var/www/html/test
ServerName test

Options FollowSymLinks
AllowOverride All


touch phpmyadmin.conf

DocumentRoot /var/www/html/phpmyadmin
ServerName phpmyadmin

Options FollowSymLinks
AllowOverride All


重启apache和mariadb
11、安装epel源
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
如果版本不一样就去这里找http://dl.fedoraproject.org/pub/epel/
rpm -ivh rpm epel-release-7-8.noarch.rpm
yum clean all
yum update
以下步骤都是在安装了epel源下进行的
12、安装mcrypt扩展
yum install php-mcrypt
13、安装redis、memcache以及扩展
yum install redis
vi /etc/redis.conf
daemonize yes#守护进程运行
redis-server /etc/redis.conf
yum install php-redis
yum install memcached
yum install php-memcached

附录:
启动|停止|重启apache systemctl start|stop|restart httpd.service
开机启动apache systemctl enable httpd.service
启动|停止|重启mariadb systemctl start|stop|restart mariadb.service
开启启动mariadb systemctl enable mariadb.service

mac安装redis以及phpredis扩展

1. git clone git://github.com/nicolasff/phpredis.git

2.cd phpredis

3.phpize

4../configure

5.make

6.sudo make install

然后编辑php.ini文件添加

extension=redis.so

备注:

如果phpize提示

Cannot find autoconf. Please check your autoconf installation
and the $PHP_AUTOCONF environment variable.
Then, rerun this script.

那么需要编译安装m4和autoconf

m4路径: http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz

autoconf路径:http://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.gz

redis图形界面

#git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
#cd phpRedisAdmin/
#git clone https://github.com/nrk/predis.git

ubuntu安装redis以及phpredis扩展

安装步骤:
1.执行:git clone https://github.com/nicolasff/phpredis.git
2.执行:cd phpredis/
3.执行:phpize
4.执行:./configure
5.执行:sudo make && make install
6.编辑php.ini添加
extension=redis.so
7.重启apache
查看phpinfo
测试:
<?php
/**
* 测试redis扩展
* User: joyous
* Date: 13-12-5
* Time: 下午1:15
*/
$redis = new Redis();
$redis->connect(‘127.0.0.1’, 6379);
$redis->set(‘k’, ‘Hello Joyous’);
var_dump($redis->get(‘k’));

memcache和redis的区别

1、Redis和Memcache都是将数据存放在内存中,都是内存数据库。不过memcache还可用于缓存其他东西,例如图片、视频等等

2、数据类型–Memcache在添加数据时就要指定数据的字节长度

3、mecache完全内存存储,redis可以实现持久存储

4、Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,hash等数据结构的存储;Memcached只是简单的K/V缓存

5、灾难恢复–memcache挂掉后,数据不可恢复; redis数据丢失后可以通过aof恢复

 

Redis安装配置以及开机启动

1.安装Redis
下载地址http://redis.io/download
wget http://download.redis.io/releases/redis-2.6.16.tar.gz

解压: tar xzf redis-2.6.16.tar.gz

cd redis-2.6.16

编译安装:make
make install

2、配置Redis

cp redis.conf /etc/redis.conf

vi /etc/redis.conf
修改如下内容:
daemonize yes#是否作为守护进程运行
logfile /dev/null #关闭日志
dir /var/lib/redis/

Continue reading