wamp环境配置
将wamp继承环境服务关闭

http
下载链接
https://www.apachehaus.com/downloads/httpd-2.4.52-o111m-x64-vc15.zip

解压到c:/Apache24
修改c:/Apache24/conf/httpd.conf,修改几个地方
1. 修改servername
将ServerName 后边的值改为127.0.0.1:80并去掉前边的注释

不然会报错httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName
然后在bin目录下,打开命令行

访问127.0.0.1,http默认访问80端口,如下

2. 修改srvroot

3. 改环境变量
这一步主要是能在cmd中直接使用httpd,不然还得cd到bin目录下才能使用

打开path,将apche的bin路径放进去

然后就可以在任意路径使用httpd.exe

4. 服务器安装配置
管理员权限

服务器的安装/卸载/停止/终止/重启的命令如下:
httpd -k install
httpd -k uninstall
httpd -k stop
httpd -k shutdown
httpd -k restart
5. 修改网站根目录
在默认情况下,apache网站根目录是htdocs

修改为老师的ppt中的c:/webphp

然后在webphp中创建一个测试文件index.html
<html><body><h1>这是c:/webphp目录下的index.html</h1></body></html>
重启服务
httpd -k restart
访问127.0.0.1

php
下载链接
https://windows.php.net/downloads/releases/php-7.4.28-Win32-vc15-x64.zip
解压到c:/php下,

重命名php.ini-development为php.ini
修改ext
在php.ini中搜索extension_dir ,修改路径,取消注释

在apache/conf/httpd.conf中加些东西

和

LoadModule php7_module "c:/PHP/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "c:/PHP"
然后restart
在WebPHP里放个info.php
<?php
phpinfo();
?>

mysql
下载链接:https://dev.mysql.com/get/Downloads/MySQLInstaller/mysql-installer-community-8.0.28.0.msi

execute

默认,往下走

设置密码

在“开始”菜单项,选择“MySQL 8.0 Command Line Client”

然后在webPHP目录下,放一个mysqli.php
<?php
error_reporting(0);
$con=mysqli_connect("127.0.0.1","root","666666");
if(!con) exit("Unable to connect to database ......");
else print("Successful database connection!");
mysqli_close($con);
?>

配置成功
|