centos7-yum安装php

1. 安装nginx

yum install nginx
##开启nginx
service nginx start



yum install nginx

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.163.com

 * extras: mirrors.ustc.edu.cn

 * updates: mirrors.163.com

No package nginx available.



怎么破:






[root@centos6-1 ~]# vim /etc/yum.repos.d/nginx.repo
#在文件中写入以下内容:
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1





然后再安装就       




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

yum install mysql-community-server

//开启mysql
service mysqld start

//查看mysql的root账号的密码
grep 'temporary password' /var/log/mysqld.log

//登录mysql
mysql -uroot -p 

//修改密码 密码过于简单不会执行成功哦
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';

//修改root用户可远程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

//刷新
flush privileges;

改为密码忘记了怎么办?

    vi /etc/my.cnf

          最后添加skip-grant-tables 这行

           保存退出,然后重启MySQL

           mysql -u root

          进入MySQL,use mysql;

          然后执行SQL,

    update user set authentication_string = password('818VKa0au3'),password_last_changed=now() where user='root';

      退出,重启MySQL  然后就可以登录了

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

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

//查看
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
---------------------配置

https://common.cnblogs.com/images/copycode.gif

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;
}
}

https://common.cnblogs.com/images/copycode.gif

4.安装redis

yum install redis
//修改配置 
vi /etc/redis.conf
//daemonize yes 后台运行
//appendonly yes 数据持久化
service redis start



5.安装php-redis扩展

推荐命令安装: yum install  php-redis 就搞定

//先装git
yum install git

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

//安装扩展
cd phpredis

./configure 

make && make install

phpize

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

//重启php
service php-fpm restart

linux-定时任务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dadashitou

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值