虚拟机CentOS搭建PHP开发环境
1. 开启上网功能
命令:cd /etc/sysconfig/network-scripts/
命令:ls #查看目录下所有文件
有一个ifcfg-******
命令:vi ifcfg-****打开
按i进入编辑状态
将onboot的no改为yes
按esc
按shift + z(z快速按两下)退出保存
命令:service network restart #重启
2.安装wget和ifconfig
命令:yum -y install wget
命令:yum install net-tools
3.更换镜像为163
命令:cd /etc/yum.repos.d/
命令:wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
命令:yum clean all
命令:yum makecache
4.关闭防火墙
命令:systemctl stop firewalld.service #停止firewall
命令:systemctl disable firewalld.service #禁止firewall开机启动
命令:firewall-cmd --state #查看默认防火墙状态(关闭后显示not running,开启后显示running)
5.安装mysql
命令:yum install mysql-server mysql
说明:CentOD7中mysql被替换为mariadb
命令:yum install mariadb-server -y #安装
命令:systemctl start mariadb.service #启动
命令:systemctl enable mariadb.service #设置开机启动
命令:systemctl stop mariadb.service #停止(可以不做)
命令:systemctl restart mariadb.service #重启(可以不做)
命令:cp /usr/share/mysql/my-huge.cnf /etc/my.cnf #拷贝配置文件
命令:mysql #进入mysql命令行
说明:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.44-MariaDB MariaDB Server
Copyright © 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>
命令:exit;#退出mysql命令行
5.1修改mysql密码
mysql_secure_installation
根据提示一路输入y
6.安装Apache
命令:yum install httpd #根据提示,输入Y安装即可成功安装
命令:systemctl start httpd.service #启动apache
命令:systemctl enable httpd.service #设

本文详细介绍了如何在虚拟机CentOS上搭建PHP开发环境,包括开启上网功能、安装必要的软件(如wget、ifconfig、MySQL、Apache、PHP),以及升级PHP到5.6版本。此外,还提供了Linux Memcached的安装步骤,包括启动、配置和测试。文章还涉及了Memcached的过期数据删除机制和一些参数限制。
最低0.47元/天 解锁文章
1243

被折叠的 条评论
为什么被折叠?



