# 环境配置

PHP版本必须在`7.1`以上，包含`7.1`

如果需要用到数据库，则需要安装并启用`mysqli扩展`，不支持PDO和传统的mysql扩展

### 需要写权限目录

```
data/log/               日志
data/cache/             缓存
data/template/cache/    模板缓存
data/template/compile/  模板编译
```

最简单的方式是进入app目录，然后执行：&#x20;

`chmod -R 777 data`&#x20;

### Nginx 配置

```
location / {
    root   /data/web/www.kaliphp.com/web/; # 这里为框架/web目录的绝对路径
    index  index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}
```

### Apache 配置

```
# 设置文档根目录为框架/web目录
DocumentRoot "/data/web/www.kaliphp.com/web/"

<Directory "/data/web/www.kaliphp.com/web/">
    RewriteEngine on
    # 如果请求的是真实存在的文件或目录，直接访问
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # 如果请求的不是真实文件或目录，分发请求至 index.php
    RewriteRule . index.php

    # 以下三行apache默认会有，如无法正常使用请自行添加
    # Options +Indexes +Includes +FollowSymLinks +MultiViews
    # AllowOverride All
    # Require local

    # ...other settings...  
</Directory>
```
