Tip of the day: If you still have users on plaintext port 6667, consider enabling Strict Transport Security to gently move users to SSL/TLS on port 6697.

UnrealIRCd webpanel:PHP8 Installation instructions

From UnrealIRCd documentation wiki
Jump to navigation Jump to search

The UnrealIRCd webpanel requires PHP 8. PHP 8 was released in 2020 so is reasonably standard nowadays. Below is Linux distro specific and FreeBSD specific information.

Ubuntu

Ubuntu 22.04 and 24.04

Ubuntu 22.04 and 24.04 ship with PHP8, so simply run: apt-get install apache2 libapache2-mod-php

If you were upgrading from an older Ubuntu version (such as 20.04) then sometimes it happens that multiple versions of PHP are installed, such as old PHP7 or PHP5.6. The webpanel will then give you an error page saying you are not using PHP8. It can also happen that the CLI version of PHP is PHP8 but the Apache module uses PHP7.4. This can be easily fixed by running a2dismod to disable the old PHP version (eg: php7.4) and a2enmod to enable the new PHP version. (eg: php8.2). Restart apache.

Ubuntu 20.04

Ubuntu 20.04 does not include PHP8 but you can use an external repository for installing PHP8, see: https://linuxhint.com/install-php-ubuntu/

Sometimes it happens that multiple versions of PHP are installed. The webpanel will then give you an error page saying you are not using PHP8. This can happen that the CLI version of PHP may be on PHP8 but the Apache module uses PHP7.4. You can fix this by running a2dismod to disable the old PHP version (eg: php7.4) and a2enmod to enable the new PHP version. (eg: php8.2). Restart apache.

Debian

Depending on your Debian version:

If you already had an older PHP on the machine, then after installing PHP8 you may now have multiple PHP versions on the machine.
You have to tell Apache to use PHP8:

  • Run a2dismod to disable the old PHP version (eg: php7.4)
  • Then run a2enmod to enable the new PHP version. (eg: php8.2)
  • Restart apache.

CentOS

https://www.tecmint.com/install-php-8-on-centos/

FreeBSD (13.2 - 14.0)

PHP 8.2 packages are available on FreeBSD binary repository.

By default, FreeBSD base system only includes the su command for elevating privileges, but you can install security/doas or security/sudo (if you prefer) from FreeBSD repository to do this as well.

Remember that to use su, your user must be included in the wheel group: pw group mod wheel -m your_unix_user

Therefore, run all the commands below as root, or precede the commands with doas or sudo.

  • First of all, update the local catalogue of the package repository: pkg update && pkg upgrade
  • After that, install PHP 8 with required plugins to use UnrealIRCd webpanel: pkg install lang/php82 lang/php82-extensions ftp/php82-curl archivers/php82-zip
  • Create php.ini config file, copying php.ini template for production environment: cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

With Apache

  • Install Apache and PHP 8 Apache module: pkg install www/apache24 www/mod_php82
  • Create the file /usr/local/etc/apache24/modules.d/001_mod-php.conf with the content:
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
  • Enable Apache service: service apache24 enable
  • Start Apache service: service apache24 start

With Nginx

  • Install Nginx: pkg install www/nginx
  • Enable php-fpm module: service php-fpm enable
  • Start php-fpm module: service php-fpm start
  • Open and Edit /usr/local/etc/nginx-dist/nginx.conf and paste these lines inside http { block:
        location ~ \.php$ {
            root   /usr/local/www/nginx-dist;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
  • Enable Nginx: service nginx enable
  • Start Nginx: service nginx start

Other

For installation methods for PHP 8 on other OS's or Linux distro's, make a websearch for how to install PHP 8 on your operating system.