这里只记录虚拟机及linux下安装php开发环境(非docker)
因为不想花钱,也不想折腾盗版,选择了免费开源的VirtualBox做虚拟机,好使。
安装过程省略。
下载linux镜像文件为centos8,太过新版也是坑啊。公寓20M的的宽带下了一个多小时。
内存只给了2g,毕竟电脑内存才16g,硬盘给了10几g,用不了多少,网络连网线,NAT模式。
nginx + php7.2 简单的php环境
首先替换yum源:
yum install epel-release -y
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装nginx:
yum install -y nginx
启动nginx并开机运行:
systemctl start nginx
systemctl enable nginx
查看版本和运行状态:
nginx -v
ps -ef | grep nginx
清空历史版本:
yum -y remove php*
安装扩展包:
yum -y install php72w cli fpm common devel embedded gd mbstring mysqlnd opcache pdo pecl-redis xml
启动php并开机运行:
systemctl start php-fpm #启动,restart-重启,stop-停止
systemctl enable php-fpm #开机启动
查看版本及运行状态:
php-fpm -v
ps -ef|grep php-fpm
centos中yum源没有mysql,于是:
下载:wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
安装:rpm -ivh mysql57-community-release-el7-9.noarch.rpm
禁用8.0版本:yum-config-manager --disable mysql80-community
启用5.7版本:yum-config-manager --enable mysql57-community
安装完后会在/etc/yum.repos.d/目录下乘车两个repo文件:
cd /etc/yum.repos.d/
yum install mysql-server
启动、查看、自启:
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
修改默认密码:
vim /etc/my.cnf
插入:skip-grant-tables
保存后就可以不用密码登录了
mysql -u root
mysql> FLUSH PRIVILEGES;
mysql> AlTER USER 'root'@'localhost' IDENTIFIED BY '123456';
然后再回到配置文件中去掉skip-grant-tables
就搞定了
暂时到环境安装这里,后续有空再更。。。。。