Upgrade From PHP 8.1.x to PHP 8.2.x for Faveo

PHP


This document will guide you to upgrade PHP version for Faveo Helpdesk from PHP 8.1.x to PHP 8.2.x on Ubuntu, Debian, Alma, Rocky, RHEL,Windows Server and on Shared Hosting (cPanel).

Introduction

Faveo Helpdesk is now powered by Laravel 10 with full PHP 8.2 support. To make the most of the latest features, kindly update your PHP version by following the instructions below.

Choose your server OS:

Before proceeding further check your current PHP version. To find out which version of PHP you are currently using, run this in the Terminal or Windows command prompt.

php -v

If you are running PHP 8.1.x, you can continue with this guide to upgrade to PHP 8.2.x

1. Ubuntu and Debian

Type the following command to remove the existing PHP version.

sudo apt-get purge php8.1*

Press y and ENTER when prompted.

After uninstalling packages, it’s advised to run these two commands.

sudo apt-get autoclean
sudo apt-get autoremove

The PHP 8.2 binary packages are only available in the Ondřej Surý PPA repository. This was already added while installing PHP 8.1, so we don’t need to add it again.

Install PHP 8.2

Update the repository cache by running the below command

sudo apt-get update

Install PHP 8.2 along with the necessary extensions required by Faveo Helpdesk.

apt install -y php8.2 libapache2-mod-php8.2 php8.2-mysql \
    php8.2-cli php8.2-common php8.2-fpm php8.2-soap php8.2-gd \
    php8.2-opcache  php8.2-mbstring php8.2-zip \
    php8.2-bcmath php8.2-intl php8.2-xml php8.2-curl  \
    php8.2-imap php8.2-ldap php8.2-gmp php8.2-redis \
    php8.2-memcached

Press Y and ENTER if prompted.

Install and configure Ioncube 8.2 extension

Download the latest IonCube Loader.

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz 
tar -xvf ioncube_loaders_lin_x86-64.tar.gz

Copy the ioncube_loader_lin_8.2.so to PHP Extension directory.

cp ioncube/ioncube_loader_lin_8.2.so /usr/lib/php/20220829

Update the PHP Configuration files

For Apache

sed -i '2 a zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"' /etc/php/8.2/apache2/php.ini
sed -i '2 a zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"' /etc/php/8.2/cli/php.ini
sed -i '2 a zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"' /etc/php/8.2/fpm/php.ini

For NGINX

sed -i '2 a zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"' /etc/php/8.2/cli/php.ini
sed -i '2 a zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"' /etc/php/8.2/fpm/php.ini

Change php-fpm default settings

sudo sed -i -e 's/^file_uploads =.*/file_uploads = On/' \
           -e 's/^allow_url_fopen =.*/allow_url_fopen = On/' \
           -e 's/^short_open_tag =.*/short_open_tag = On/' \
           -e 's/^memory_limit =.*/memory_limit = 256M/' \
           -e 's/^;cgi.fix_pathinfo=1.*/cgi.fix_pathinfo = 0/' \
           -e 's/^upload_max_filesize =.*/upload_max_filesize = 100M/' \
           -e 's/^post_max_size =.*/post_max_size = 100M/' \
           -e 's/^max_execution_time =.*/max_execution_time = 360/' \
           /etc/php/8.2/fpm/php.ini

Enable php-fpm

For Apache

a2enconf php8.2-fpm

For Nginx

If you are using Faveo with nginx webserver, make the following change in faveo.conf file.

nano /etc/nginx/sites-available/faveo.conf

Change this line fastcgi_pass unix:/var/run/php/php8.1-fpm.sock; to below to use php8.2-fpm.sock.

fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

Restart Webserver

For Apache

systemctl restart php8.2-fpm
systemctl restart apache2

For Nginx

systemctl restart php8.2-fpm
systemctl restart nginx

2. Alma, Rocky and RHEL

In Alma, Rocky and RHEL machines, we can simply upgrade from a lower version of PHP to a higher version by switching the Repository.

For RHEL you may come accorss with this error while installing php8.2 This system is not registered with an entitlement server. You can use subscription-manager to register.. To resolve this error follow this official documentation of RHEL, if you don't have a Licensed RHEL server, do the following change in the plugin configuration file to disable plugin vim /etc/yum/pluginconf.d/subscription-manager.conf change enabled=0

Run the below commands to disable PHP 8.1 and enable PHP 8.2 Remi repo.

sudo dnf module reset php:remi-8.1 -y
sudo dnf module enable php:remi-8.2 -y

Now run the below command to update to PHP 8.2

sudo yum update -y

Now install the below php extensions which were not installed earlier in php 8.1

yum -y install php-pecl-memcached php-pecl-memcache

Install and configure IonCube 8.2 extension

wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfz ioncube_loaders_lin_x86-64.tar.gz

Copy the ioncube_loader_lin_8.2.so to PHP Extension directory.

cp ioncube/ioncube_loader_lin_8.2.so /usr/lib64/php/modules

Update the PHP configuration file

sed -i 's:ioncube_loader_lin_8.1.so:ioncube_loader_lin_8.2.so:g' /etc/php.ini
sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php.ini

Restart php-fpm

systemctl restart php-fpm 

Restart Webserver

For Apache

sudo systemctl restart httpd

For Nginx

sudo systemctl restart nginx

1. Windows Servers

  • Click Here to download php 8.2.9 NTS 64bit file. Extract the zip file & rename it to php8.2. Now move the renamed php8.2 folder to C:\php8.2.

  • Open php8.2 folder, find php.ini-development & rename it to php.ini to make it php configuration file.

  • Open php.ini using Notepad++, add the below lines at the end of this file & save the file:

Required configuration changes for Faveo Helpdesk.

error_log=C:\Windows\temp\PHP82x64_errors.log
upload_tmp_dir="C:\Windows\Temp"
session.save_path="C:\Windows\Temp"
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
date.timezone=Asia/Kolkata
extension_dir="C:\php8.2\ext\"
upload_max_filesize = 100M
post_max_size = 100M
memory_limit = 256M

Uncomment these extensions.

extension=bz2
extension=curl
extension=fileinfo
extension=gd2
extension=imap
extension=ldap
extension=mbstring
extension=mysqli
extension=soap
extension=sockets
extension=sodium
extension=openssl
extension=pdo_mysql

Update the Environment Variable for PHP Binary

  • Right click on This PC, go to Properties > Advanced System Settings > Environment Variables.

  • Now click on Path > Edit > New & add copied path C:\php8.2\ here and click OK in all 3 tabs.

Enable cacert.pem File in PHP Configuration File

  • Click Here to download cacaert.pem file. This is required to avoid the “cURL 60 error” which is one of the Probes that Faveo checks.

  • Extract the cacert.pem file and copy it to C:\php8.2 path.

  • Edit the php.ini located in C:\php8.2, Uncomment curl.cainfo and add the location of cacert.pem to it as below:

curl.cainfo = "C:\php8.2\cacert.pem"

Install Ioncube Loader

  • Click Here to download Ioncube Loader zip file, Extract the zip file.

  • Copy the ioncube_loader_win_8.2.dll file from extracted Ioncube folder and paste it in the PHP extension directory C:\php8.2\ext.

  • Add the below line in your php.ini file at the starting to enable Ioncube.

zend_extension = "C:\php8.2\ext\ioncube_loader_win_8.2.dll"

Create FastCGI Handler Mapping

  • Open Server Manager, locate Tools on the top right corner of the Dashboard, Open Internet Information Services (IIS) Manager.

  • Now in the Left Panel of the IIS Manager select the server then you will find the Handler Mappings it will populate the available options to configure.

  • Open Handler Mappings, Select FastCGI Click on Edit in the Right Panel and update c:\php8.2\php-cgi.exe path.

  • Click on OK and restart the IIS server once.

Unfortunately, php-redis and php-memcached extensions for Windows are not available officially yet for php8.2, Once they are available, the document will be updated.


4. cPanel

  • To enable PHP 8.2 in cPanel the PHP version has to be installed in the server this is done through WHM, This can be done by contacting your Hosting Provider.

  • After installing PHP 8.2 on the server we need to change the php version for the faveo domain, follow the below steps to do so.

  • Login to the cPanel and search for MultiPHP Manager as shown in the below snap.

  • After opening the MultiPHP Manager select the “checkbox” of the domain, change the PHP version from the drop-down to PHP 8.2 and click Apply as shown in the below snap.

Note: If you are not able to find the PHP version in the drop-down then it is not installed on the server Please contact your Hosting provider and install PHP-8.2 and try again.

  • Once PHP 8.2 is updated to the domain we need to update PHP version in cron as well to do so, search for Cron Jobs in the Cpanel search and click on it to open the cron jobs page as below.

  • Once we get to the cronjobs page we need to edit the cron to use the php8.2, to do so we need to edit the cron job to use the domain-specific php path and save as shown in the below snap with the below commands.

Change This

/usr/local/bin/ea-php8.1 

To This

/usr/local/bin/ea-php8.2


Updated: