php71w mysql是什么_php7

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;

~~~

这里写图片描述

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

~~~

~~~

//server配置

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

//重启php

service php-fpm restart

在系统服务目录里创建nginx.service文件

vi /lib/systemd/system/nginx.service

写入以下内容(路径改成自己的)

~~~

[Unit]

Description=nginx

After=network.target

[Service]

Type=forking

ExecStart=/www/lnmp/nginx/sbin/nginx -c /www/lnmp/nginx/conf/nginx.conf

ExecReload=/www/lnmp/nginx/sbin/nginx -s reload

ExecStop=/www/lnmp/nginx/sbin/nginx -s quit

PrivateTmp=true

[Install]

WantedBy=multi-user.target

~~~

在系统服务目录里创建php-fpm.service文件

vi /lib/systemd/system/php-fpm.service

写入以下内容(路径改成自己的)

~~~

[Unit]

Description=php-fpm

After=network.target

[Service]

Type=forking

ExecStart=/www/lnmp/php/sbin/php-fpm

PrivateTmp=true

[Install]

WantedBy=multi-user.target

~~~

[Unit]:服务的说明

Description:描述服务

After:描述服务类别

[Service]服务运行参数的设置

Type=forking是后台运行的形式

ExecStart为服务的具体运行命令

ExecReload为重启命令

ExecStop为停止命令

PrivateTmp=True表示给服务分配独立的临时空间

注意:[Service]的启动、重启、停止命令全部要求使用绝对路径

[Install]运行级别下服务安装的相关设置,可设置为多用户,即系统运行级别为3

测试并加入开机自启

先关闭nginx,php-fpm

使用以下命令开启

systemctl start nginx.service #如果服务是开启状态,使用此命令会启动失败。

systemctl start php-fpm.service

开启成功,将服务加入开机自启

systemctl enable nginx.service #注意后面不能跟空格

systemctl enable php-fpm.service

重启服务器,查看是否启动

shutdown -r now #重启

systemctl list-units --type=service #查看运行的服务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值