1,php官网下载php稳定版,如7.2.2 gz压缩包,MySQL共享包(百度搜索关键词rpm,搜索到rpm search,进入搜索mysql-shared)
2,打开虚拟机,xshell连接
3,进入src目录下(cd /usr/local/src),上传(rz),查看目录即查看上传结(ls)(重复以上操作,分别上传php包、mysql共享库包到src下),安装mysql共享包(rpm -ivh src下上传的MySQL包名称(mysql包路径)),挂载光盘(mount /dev/cdrom /dyy),安装libxml2(yum install libxml2),安装libxml2库(yum install libxml2-devel),安装perl(yum install perl),安装perl库(yum install perl-devel),卸载之前安装的httpd(rm -rf /usr/local/httpd),进入原始httpd解压包目录内(cd httpd-2.4.39),查看目录(ls),清除make产生的部分文件(make clean),配置httpd,开启cgi 及so共享库(./configure --prefix=/usr/local/httpd --enable-cgi --enable-so),编译(make),安装(make install),退回上一次目录src内(cd ..),解压PHP安装包(tar -zxvf PHP压缩包名),查看便于下一步复制解压名(ls),进入解压包目录(cd 解压包名),配置php并关联apache、MySQL(./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config),编译php(make),安装PHP(make install),复制配置文件( cp php.ini-development /usr/local/php/lib/php.ini),编辑PHP配置文件,去掉extension=mysqli前的注释(vi /usr/local/php/lib/php.ini),编辑apache配置文件,去掉ServerName前注释配置域名并添加识别php语言AddType application/x-httpd-php .php(vi /usr/local/httpd/conf/httpd.conf),重启apache(/usr/local/httpd/bin/apachectl start),关闭防火墙或释放80端口(systemctl stop firewalld.service),写个测试文件输出phpinfo()(vi /usr/local/httpd/htdocs/test.php)=》访问ip/test.php 看到phpinfo信息并搜索mysql看到mysql模块,启动mysql服务(/usr/local/mysql/support-files/mysql.server start),登录mysql(/usr/local/mysql/bin/mysql -u root -p),创建库表写入信息,以连接查看测试mysql

补充:1,安装cms系统,鉴于DedeCMS在编译php时需要GD库、安装jpeg及png库,所以以上安装做如下调整
上传dece包,配置php之前,安装jpeg、png库(yum install libjpeg-devel libpng-devel),配置php加上gd库(./configure --prefix=/usr/local/php --with-apxs2=/usr/local/httpd/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --with-jpeg-dir),编辑php配置文件(除以上更改外另extension=gd2),编辑apache配置文件(除以上更改外另配置默认首页(
DirectoryIndex index.html
改为
DirectoryIndex index.html index.php
)、开启权限(Options Indexes FollowSymLinks 改为Options FollowSymLinks))
2,安装DedeCMS
进入src目录,解压包(tar -zxvf DEDE包名称),清空项目目录(rm -rf /usr/local/httpd/htdocs/),复制源码到项目目录下(cp ./DedeCMS-V5.7-UTF8-SP2/uploads/ /usr/local/httpd/htdocs/),进入项目目录下(cd httpd/htdocs),给文件权限(chmod -R 777 /usr/local/httpd/htdocs)
3,手动安装Dede,通过ip访问站点,同意 继续-》继续-》数据库主机 127.0.0.1 设置密码(记住管理员初始密码)-》继续-》进入前后台简单查看