依赖
- PHP8.1
- MongoDB 4.4
- Nginx
- Redis 6.2
框架 thinkphp8.0
https://doc.thinkphp.cn/v8_0/controller.html
安装
php.ini需要去掉以下禁用函数
proc_open
putenv
exec
proc_get_status
nginx配置伪静态
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
}
}
location /uploads/ {
try_files $uri /image_cache/index.php/$uri;
}
目录权限
chmod -R 777 runtime
chmod -R 777 data
mkdir public/uploads
chmod -R 777 public/uploads
缓存
定义缓存前缀
CACHE_PRE = kk
composer源
composer config -g repo.packagist composer https://repo.packagist.org
RPC
依赖 webtool
#RPC_WEBTOOL_URL = http://tool
# RPC请求
rpc_secret =
IGNORE_SIGN = true
CDN
如果使用cdn,请在.env中配置cdn_url
# CDN 激活
active_cdn = 1
# CDN 地址 支持以,分隔
CDN_URL = https://mac1.qihetaiji.com,https://mac.qihetaiji.com
且到public目录执行 composer install
Pecl安装扩展
mongodb安装
wget https://pecl.php.net/get/mongodb-1.16.2.tgz
tar -xvf mongodb-1.16.2.tgz
/www/server/php/81/bin/phpize
./configure --with-php-config=/www/server/php/81/bin/php-config
make && make install
yar 安装
wget https://pecl.php.net/get/yar-2.3.2.tgz
tar -xvf yar-2.3.2.tgz
/www/server/php/81/bin/phpize
./configure --with-php-config=/www/server/php/81/bin/php-config
make && make install
php.ini
extension=/www/server/php/81/lib/php/extensions/no-debug-non-zts-20210902/mongodb.so
extension = /www/server/php/81/lib/php/extensions/no-debug-non-zts-20210902/yar.so
如出现 psr/simple-cache 3.0+ is not compatible with this version of symfony/cache. Please upgrade symfony/cache to 6.0+ or downgrade psr/simple-cache to 1.x or 2.x.
composer require symfony/cache ^6 symfony/var-dumper ^6