扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
这篇文章将为大家详细讲解有关centos7中yum如何安装php,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
和平ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:028-86922220(备注:SSL证书合作)期待与您的合作!centos7 yum安装php的方法:首先安装nginx以及MYSQL;然后通过命令“yum install php71w php71w-fpm php71w-cli php71w-common...”安装php以及扩展即可。
centos7 yum快速安装php7.1
1. 安装nginx
yum install nginx ##开启nginx service nginx start
2.安装MYSQL
yum localinstall /tupian/20230522/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 /tupian/20230522/epel-release-latest-7.noarch.rpm rpm -Uvh /tupian/20230522/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 { 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 /tupian/20230522/phpredis //安装扩展 cd phpredis phpize //修改php配置 vi /etc/php.ini 添加extension=redis.so //重启php service php-fpm restart
关于centos7中yum如何安装php就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流