centos7 yum快速安裝php7.1

1. 安裝nginx

yum install nginx ##開啓nginx service nginx start

2.安裝MYSQL
yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmphp

yum install mysql-community-serverhtml

//開啓mysql
service mysqld startmysql

//查看mysql的root帳號的密碼
grep 'temporary password' /var/log/mysqld.lognginx

//登陸mysql
mysql -uroot -pgit

//修改密碼
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';github

//修改root用戶可遠程登陸
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION; web

//刷新
flush privileges;redis

3.安裝php
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmsql

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpmphp7

//查看
yum search php71w

//安裝php以及擴展
yum install php71w php71w-fpm php71w-cli php71w-common php71w-devel php71w-gd php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath

//開啓服務
service php-fpm start

//修改/etc/nginx/nginx.conf 使其支持php 見下
//重啓nginx
service nginx restart
---------------------配置

 

server {
charset utf-8;
client_max_body_size 128M;

listen 80; ## listen for ipv4

server_name localhost;
root /var/www/;
index index.php;

location / {
if (!-e $request_filename){
rewrite ^/(.*)$ /index.php/$1 last;
}
try_files $uri $uri/ /index.php?$args;
}

location ~ \.php$ {
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
try_files $uri =404;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/?.*)$;
fastcgi_param SCRIPT_FILENAME
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
}

error_page 404 /404.html;
location ~ /\.(ht|svn|git) {
deny all;
}
}

4.安裝redis



yum install redis //修改配置 vi /etc/redis.conf //daemonize yes 後臺運行 //appendonly yes 數據持久化 service redis start

5.安裝php-redis擴展
//先裝git
yum install git

//git下擴展
cd /usr/local/src
git clone https://github.com/phpredis/phpredis.git

//安裝擴展
cd phpredis
phpize

//修改php配置
vi /etc/php.ini 添加extension=redis.so

//重啓phpservice php-fpm restart

相關文章
相關標籤/搜索