Linux centos 6 配置php环境,扩展redis

 

1.首先安装一个虚拟机(我自己版本:VM 10.0.4)

     yum -y install openssl psmisc openssl-devel php-devel pcre-devel gcc gcc-c++ libxml2 libcurl.x86_64 libcurl-devel.x86_64 bzip2-devel.x86_64 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel

     1.首先把上面需要的包都安装了,不然后面很容易报错的。

     2.用ifconfig查看你的IP

2.终端连接Linux(我用的是:smarTTY)

     2.1 如果链接不上的话,试一下以下方法(1.开启ssh执行: srevice sshd start 2.关闭防火墙:service iptables stop)

 

3.安装软件(我是下载到/usr/local/tools目录下如下图:)

      

  3.1首先安装Nginx

    1.下载nginx(下载地址:wget http://nginx.org/download/nginx-1.5.9.tar.gz)

    2.解压(命令:tar -zxvf nginx-1.5.9.tar.gz)

    3.切换目录(命令:cd nginx-1.5.9)

    4.配置(命令:

./configure --prefix=/usr/local/nginx \
--with-http_ssl_module --with-http_spdy_module \
--with-http_stub_status_module --with-pcre

)

    5.编译安装(命令:make && make install)

    6.开启nginx(命令:/usr/local/nginx/sbin/nginx。nginx安装目录放到/usr/local/nginx中)

    (当你看到下面这个页面的时候说明你安装nginx成功了)

   3.2安装php环境

    1.下载php(下载地址:wget http://cn2.php.net/distributions/php-5.6.28.tar.gz)

    2.解压(命令:tar -zxvf php-5.6.28.tar.gz)

    3.切换目录(命令:cd php-5.6.28)

    4.配置(命令:

./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-config-file-path=/etc --with-bz2 --with-curl --with-mhash

)

    5.编译安装(命令:make && make install)

    6.复制php配置文件(cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf)

    7.开启php(命令:/usr/local/php/sbin/php-fpm。php安装目录放到/usr/local/php中)

    8.配置nginx的cgi(修改路径:/usr/local/nginx/conf/nginx.conf)

    

  3.3安装redis

    1.下载php(下载地址:wget http://cn2.php.net/distributions/php-5.6.28.tar.gz)

    2.解压(命令:tar -zxvf php-5.6.28.tar.gz)

    3.切换目录(命令:cd php-5.6.28)

    4.配置(命令:

./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm --with-config-file-path=/etc --with-bz2 --with-curl --with-mhash

)

    5.编译安装(命令:make && make install)

    6.复制php配置文件(cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf)

posted @ 2017-02-06 16:46  qq6105406222  阅读(187)  评论(0编辑  收藏  举报