1.Apache
修改httpd.conf文件配置(在conf文件夹中) Define SRVROOT后面为apache路径(不要复制,路径要手动输入)
原文件: Define SRVROOT "${SRVROOT}" ServerRoot "${SRVROOT}" 举例: Define SRVROOT "D:/server/Apache24" ServerRoot "${SRVROOT}"

添加httpd.conf文件配置(在conf文件夹中)
php7: PHPIniDir "D:/server/php7.4" LoadModule php7_module "D:/server/php7.4/php7apache2_4.dll" AddType application/x-httpd-php .php .html .htm PHPIniDir 为PHP路径,LoadModule php7_module为dll路径,php要选线程安全(ts)版本,否则没有dll文件。

php8:
PHPIniDir "D:/server/php8.1" LoadModule php_module "D:/server/php8.1/php8apache2_4.dll" AddType application/x-httpd-php .php .html .htm
php5:
PHPIniDir "D:/server/php5.6"
LoadModule php5_module "D:/php/php5apache2_4.dll"
AddType application/x-httpd-php .php .html .htm
2.PHP
修改php.ini-development文件,修改文件名为php.ini 去掉extension_dir 前面分号,后面是PHP路径
原文件:
; On windows: ; extension_dir = "/" 举例: ; On windows: extension_dir = "D:/server/php7.4"
3.完成
win+R开启cmd
cd /d D:/server/Apache24/bin 回车
httpd.exe -k install -n "Apache24" 回车(Apache24是给服务起的名字)

?4.测试
找到Apache的htdocs文件夹(可以在httpd.conf中配置默认页文件夹),新建phpinfo.php,网页测试。

|