centos7 yum安装php的方法:首先安装nginx以及MYSQL;然后通过命令“yum install php71w php71w-fpm php71w-cli php71w-common...”安装php以及扩展即可。

推荐:《php视频教程》
centos7 yum快速安装php7.1
1. 安装nginx
1 2 3 | yum install nginx
##开启nginx
service nginx start
|
Copier après la connexion
2.安装MYSQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | yum localinstall http:
yum install mysql-community-server
service mysqld start
grep 'temporary password' / var /log/mysqld.log
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
flush privileges;
|
Copier après la connexion
3.安装php
1 2 3 4 5 6 7 8 9 10 11 12 | rpm -Uvh https:
rpm -Uvh https:
yum search php71w
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
service nginx restart
---------------------配置
|
Copier après la connexion
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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;
}
}
|
Copier après la connexion
4.安装redis
1 2 3 4 5 6 | yum install redis
vi /etc/redis.conf
service redis start
|
Copier après la connexion
5.安装php-redis扩展
1 2 3 4 5 6 7 8 9 10 11 12 | yum install git
cd /usr/local/src
git clone https:
cd phpredis
phpize
vi /etc/php.ini 添加extension=redis.so
service php-fpm restart
|
Copier après la connexion
Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!