windows下配置apache php8 mysql

首先下载安装mysql,按照提示一步一步安装直至完成,mysql下载地址为:

https://dev.mysql.com/downloads/installer/

再下载php,下载地址为:

https://www.php.net/downloads.php

选择VS17 x64 Thread Safe版本的zip压缩包,然后解压至c:/php,操作以下项:

将php.ini-development重命名为php.ini,然后编辑该文件;

更改 extension_dir = "c:/php/ext"

将下列前面的;号去除,即:

extension=bz2
extension=curl
extension=gd
extension=mbstring
extension=mysqli
extension=openssl
extension=pdo_mysql
extension=zip

date.timezone = PRC

下载并安装apache,下载地址为:

https://httpd.apache.org/

编辑httpd.conf文件

<Directory "d:/php">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
给目录权限
<VirtualHost *:80>
    ServerName www.test.com
    DocumentRoot "d:/php/test"
</VirtualHost>
添加测试站点,可指hosts访问
LoadModule php_module "c:/php/php8apache2_4.dll"
PHPIniDir "c:/php"
AddType application/x-httpd-php .php
在末尾处添加

如果curl出现Uncaught Error: Call to undefined function curl_init():

将php目录下的libcrypto-3-x64.dll、libssh2.dll、libssl-3-x64.dll、nghttp2.dll复制到apache的bin目录