配置环境:debian fun工具 docker
参考:https://github.com/alibaba/funcraft/blob/b458f014b6/src/lib/frameworks/support/php/Makefile
https://github.com/alibaba/funcraft/blob/b458f014b6/src/lib/frameworks/support/php/Funfile
根据这里的内容,大致可以猜测出,使用fun install自己构建
创建fun项目
找一个目录
fun init # 随便选一个项目
fun install init # 这里也随便选
在新增的Funfile中填写内容:
RUNTIME custom
RUN apt-get update
RUN apt-get -y install apt-transport-https lsb-release ca-certificates wget
RUN wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
RUN apt-get update
RUN fun-install apt-get install nginx
RUN fun-install apt-get install php8.0-common
RUN fun-install apt-get install php8.0-fpm
RUN fun-install apt-get install php8.0-cli
RUN fun-install apt-get install php8.0-cgi
RUN fun-install apt-get install php8.0-mbstring
RUN fun-install apt-get install php8.0-mysql
RUN fun-install apt-get install php8.0-xml
RUN fun-install apt-get install php8.0-soap
RUN fun-install apt-get install php8.0-gd
RUN fun-install apt-get install php8.0-intl
RUN fun-install apt-get install php8.0-ldap
RUN fun-install apt-get install php8.0-zip
RUN fun-install apt-get install php8.0-curl
RUN fun-install apt-get install php8.0-opcache
RUN fun-install apt-get install php8.0-readline
RUN fun-install apt-get install php8.0-simplexml
RUN fun-install apt-get install php8.0-tokenizer
运行fun install
进行构建,随后运行zip -q -r dist.zip .fun/root/ -x ".fun/root/usr/share/" -x ".fun/root/lib/systemd/
配置原有的laravel
在原来的laravel项目中fun deploy -y
进行配置,不再赘述
将原项目中的.fun移动到别处(后称旧.fun)
将dist.zip中的内容复制到项目的.fun文件夹中,随后进行修改:
.fun/root/etc/php/8.0/fpm/php-fpm.conf
填写内容:
[global]
pid = /tmp/php8.0-fpm.pid
error_log = /tmp/php8.0-fpm.log
include=/code/.fun/root/etc/php/8.0/fpm/pool.d/*.conf
.fun\root\etc\php\8.0\fpm\pool.d
填写内容:
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9527
listen.owner = www-data
listen.group = www-data
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
env["STORAGE_PATH"] = $STORAGE_PATH
旧.fun/root/etc/nginx中所有内容复制到新.fun/root/etc/nginx
旧.fun/root/usr/lib/php/7.2/php.ini-production复制到.fun/root/usr/lib/php/8.0/php.ini-production
搜索extension_dir配置项,目录最后的数字按照实际情况来填写,例如extension_dir = "/code/.fun/root/usr/lib/php/20200930/"
项目中 laravel_bootstrap
文件,搜索所有7.2
字符串,替换为8.0
差不多就好了
