Do not copy and paste this code, it requires changes
Other PHP versions available here: https://gist.github.com/search?q=user%3Amrl22+moss
As of writing this, Moss.sh does not support PHP 8.2 via the control panel even though Ubuntu does.
Set up your website using Moss.sh and select Apache with PHP 7.4.
Once complete, we need to install PHP 8.2 with all the packages moss installs for 7.4.
apt install php8.2-bcmath php8.2-bz2 php8.2-cli php8.2-common php8.2-curl php8.2-dev php8.2-fpm php8.2-imap php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-pgsql php8.2-readline php8.2-soap php8.2-sqlite3 php8.2-xml php8.2-xmlrpc php8.2-zip php8.2-gd php8.2-igbinary php8.2-imagick php8.2-memcached php8.2-msgpack
Lets configure PHP 8.2 FPM for the sites user so that Apache or NGINX can process PHP scripts. Make sure to change myuser
to your sites user.
cp /etc/php/8.2/fpm/pool.d/www.conf /etc/php/8.2/fpm/pool.d/myuser.conf
sed -i 's/\[www\]/\[myuser\]/g' /etc/php/8.2/fpm/pool.d/myuser.conf
sed -i 's/www-data/myuser/g' /etc/php/8.2/fpm/pool.d/myuser.conf
sed -i 's/php8.2-fpm/php8.2-fpm-myuser/g' /etc/php/8.2/fpm/pool.d/myuser.conf
Restart php-fpm
service php8.2-fpm reload
Now we switch Apache/NGINX/OpenResty from PHP 7.4 to 8.2 by replacing some words. Again, make sure to replace myuser
and mysite.com
configuration file.
Apache Method
sed -i 's/php7.4-fpm-myuser/php8.2-fpm-myuser/g' /etc/apache2/sites-enabled/mysite.com.conf
Restart Apache
service apache2 restart
NGINX/OpenResty Method
Moss.sh uses OpenResty which is a fork of NGINX, but they label it as NGINX in their control panel.
sed -i 's/php7.4-fpm-myuser/php8.2-fpm-myuser/g' /usr/local/openresty/nginx/sites/mysite.com.conf
Restart OpenResty
service openresty restart
I was looking for the solution for almost 2 hours and it might have taken another 2 if you hadn’t posted this. Thanks a lot, man.