window apache/php
最后更新于:2022-04-02 02:34:47
[TOC]
> [php最新版下载](https://windows.php.net/download)
> [apache 最新版下载](https://www.apachelounge.com/download)
## 概述
php 必须是 thread-safe版本
## 安装php
1. 复制份`php.ini-production`,并改名为`php.ini`。
2. 如无法找到模块,则使用``,`phpinfo()`还是没有,
## 安装apache
修改配置
```
ServerRoot "./"; # 正确的路径,若错误先错误则改为绝对路径
DirectoryIndex index.php index.html # 添加 index.php
extension_dir="ext" # 模块未加载,使用绝对路径
Define PHP_ROOT "../php7_4_10"
LoadModule php7_module "${PHP_ROOT}/php7apache2_4.dll"
PHPIniDir "${PHP_ROOT}"
LoadFile "${PHP_ROOT}/libssh2.dll" # 修复php7 无法使用curl问题
AddHandler application/x-httpd-php .php
Include conf/vhost/*.conf
```
添加站点
DocumentRoot ../${SITE_NAME}
ServerName default:8010
ErrorLog logs/${SITE_NAME}-error_log
Options FollowSymLinks
AllowOverride All
Require all granted
```
### 常用apache 命令 ``` httpd -k install [-n "service name" ] [-f "D:\conf\custom.conf"] #默认为服务名Apache2.4 httpd -k uninstall [ -n "服务名" ] httpd -k start httpd -k stop httpd -k restart httpd [-n "服务名"] -t // checkout ```
';
vhost/im_site.conf
``` # 声明一个端口 Listen 8010 Define SITE_NAME www### 常用apache 命令 ``` httpd -k install [-n "service name" ] [-f "D:\conf\custom.conf"] #默认为服务名Apache2.4 httpd -k uninstall [ -n "服务名" ] httpd -k start httpd -k stop httpd -k restart httpd [-n "服务名"] -t // checkout ```