linux使用yum安装php的方法:1、执行“mkdir /usr/local/php”命令;2、下载yum源的更新安装包;3、安装相关yum源安装包;4、通过“yum install”命令安装php即可。
一、yum安装php
1、mkdir /usr/local/php
2、cd /usr/local/php
3、下载yum源的更新安装包
立即学习“PHP免费学习笔记(深入)”;
centOS 6.x源
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmwget https://mirror.webtatic.com/yum/el6/latest.rpm
centOS 7.x源
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmwget https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
4、安装相关yum源安装包(这里以centOS 7.x的为例)
rpm -Uvh epel-release-latest-7.noarch.rpmrpm -Uvh webtatic-release.rpm
5、查看该源对应的php安装包命令(以PHP 为例)
yum list --enablerepo=webtatic | grep php
6、查找php 5.6版本的安装包
yum search php56w
7、安装Apache
yum install httpd httpd-devel
8、关闭firewalld防火墙
systemctl stop firewalld.service systemctl disable firewalld.service systemctl status firewalld
9、启动apache
/bin/systemctl start httpd.service
此时用浏览器访问你服务器IP地址 应该是Testing 123文件页面。
10、安装mysql【这里因为之前使用tar包安装了mysql,所以不安装】
11、启动mysql
systetcl start mysql
***如果启动mysql时报错
Failed to start mysql.service: Unit mysql.service failed to load: No such file or directory.
或者
Failed to start mysqld.service: Unit not found
则需要安装mariadb-server并启动,添加到开机自启动
yum install -y mariadb-serversystemctl start mariadb.servicesystemctl enable mariadb.service
12、安装PHP
yum install php56w
13、重启apache使php生效
/bin/systemctl restart httpd.service
14、查看PHP的版本
php -v
15、php的简单使用
进入目录/var/www/html
vi index.php(必须是index.php【主页】才会在浏览器显示)
内容如下:
以上就是linux如何使用yum安装php的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/123511.html
微信扫一扫
支付宝扫一扫


