centos7 yum安装 php的方法
2022-12-02 09:01:16
106
{{single.collect_count}}
centos7 yum安装php的方法:首先安装nginx以及MYSQL;然后通过命令“yum install php71w php71w-fpm php71w-cli php71w-common...”安装php以及扩展即可。

php入门到就业线上直播课:进入学习
Apipost = Postman + Swagger + Mock + Jmeter 超好用的API调试工具:点击使用

推荐:《php视频教程

centos7 yum快速安装php7.1

1. 安装nginx

yum install nginx##开启nginxservice nginx start
登录后复制

2.安装MYSQL

yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpmyum install mysql-community-server//开启mysqlservice mysqld start//查看mysql的root账号的密码grep 'temporary password' /var/log/mysqld.log//登录mysqlmysql -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.rpmrpm -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 见下//重启nginxservice nginx restart---------------------配置
登录后复制

server {charset utf-8;client_max_body_size 128M;listen 80; ## listen for ipv4server_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_FILENAMEfastcgi_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扩展

//先装gityum install git//git下扩展cd /usr/local/srcgit clone https://github.com/phpredis/phpredis.git//安装扩展cd phpredisphpize//修改php配置vi /etc/php.ini 添加extension=redis.so//重启phpservice php-fpm restart
登录后复制

以上就是centos7 yum安装 php的方法的详细内容,更多请关注php中文网其它相关文章!

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}