Debian 12 安装 HestiaCP 面板并添加 PHP 8.3 于安装 Redis 扩展及启用 shell_exec 函数

之前一直使用的 VestaCP 面板已经很久没有更新了(据官网消息又重新维护更新了好像),导致其只支持 RHEL / CentOS 5,6,7 、 Debian 7,8,9 、 Ubuntu 12 . 04 – 18 . 10。现在 Debian 都发展到12了,Centos 7 也已经安全支持都快无了。

之前运行正常的环境还可以不管,但是我有台环境目前出现了故障可能要进行重装操作。但是那 VPS 貌似最低只有 Debian 10 的模板了,导致无法继续使用 VestaCP 面板,这不只能先体验一下分支 HestiaCP 面板。

一、安装 HestiaCP

HestiaCP 支持 Debian 10, 11 or 12 、 Ubuntu 20.04, 22.04 LTS,因此可以说刚刚好。

1、下载

wget https://raw.githubusercontent.com/hestiacp/hestiacp/release/install/hst-install.sh

2、安装

bash hst-install.sh

默认完全安装,环境、数据库、DNS、邮箱等一整套都会安装。

二、添加 PHP 8.3 环境

当前安装默认是 PHP 8.2的环境,面板设置有个PHP版本的勾选项,但是我暂时还不知道是指哪里的PHP,且没有想要的8.3就暂时不勾选了。

在官方社区找到答案,启用 PHP 8.3 环境支持。

v-add-web-php 8.3

支持多PHP版本共存,但是是FPM/FastCGI,我不知道跟Apache 2.0 Handler 相比有何区别。

三、安装 php-redis 扩展

由于有 Redis 需求,因此需要安装 php-redis 扩展支持

apt install php8.3-redis

给 PHP 8.3 安装,如果 8.2 需要安装应该是要改一下吧?!

四、启用 shell_exec 函数

由于程序需要,不得不启用该函数,虽然有些危险

编辑/etc/php/8.3/fpm/php.ini文件,删除disable_functions里面的shell_exec

删除前:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen

删除后:

disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,proc_open,popen

重启:

systemctl restart php8.3-fpm.service

五、题外话

体验时间较短,暂时无法有什么体会。就是这个默认不支持/建议使用admin账户创建网站,需要新建一个账户才能创建网站跟在界面上创建数据库。虽然admin账户可以通过手动输入url也能打开数据库管理功能。

ChiuYut

2024年04月16日

发布者

ChiuYut

咦?我是谁?这是什么地方? Ya ha!我是ChiuYut!这里是我的小破站!