Skip to main content
Version: 7.0

Ubuntu

Basic actions

  • Before updating PHP, if Passwork is installed in a cloud/virtual environment, create a snapshot of the virtual OS state to restore functionality in case of incorrect update;
  • Obtain root privileges and update the local package database:
sudo -i 
apt-get update

Removing PHP

Determine the PHP version:

php -v
danger

Depending on the PHP version used (8.0 or 8.2), use the following commands to remove the outdated version.

Disable the module for the Apache2 web server:

a2dismod php8.2

Remove the main package, drivers, and PHP extensions:

apt-get remove -y php8.2 php8.2-*

Remove the directory with nested PHP files:

rm -rf /etc/php/8.2

Installing PHP

Install PHP and extension modules:

apt install -y php8.3-cli php8.3-bcmath php8.3-fpm php8.3-curl php8.3-gd php8.3-intl php8.3-ldap php8.3-mbstring php8.3-mysql php8.3-opcache php8.3-pgsql php8.3-soap php8.3-zip php8.3-sqlite3 php8.3-xml php8.3-dev php-pear

Installing PHP MongoDB driver

Install the PHP MongoDB driver:

pecl install -f mongodb

Create configuration files to load and enable PHP MongoDB:

echo "extension=mongodb.so" | tee /etc/php/8.3/fpm/conf.d/20-mongodb.ini
echo "extension=mongodb.so" | tee /etc/php/8.3/cli/conf.d/20-mongodb.ini

Force enable PHP for Apache2 and switch the alternative version for executable files:

update-alternatives --set php /usr/bin/php8.3
update-alternatives --set phar /usr/bin/phar8.3
update-alternatives --set phar.phar /usr/bin/phar.phar8.3

Changing PHP handler of the web server to php-fpm

Make sure the php8.3-fpm service is running:

systemctl status php8.3-fpm

Start and enable autostart of the service if it is stopped:

systemctl start php8.3-fpm
systemctl enable php8.3-fpm

Edit the Passwork server virtual host configured to work over HTTPS:

nano /etc/apache2/sites-enabled/default-ssl.conf

Change the .php file handler by specifying proxying requests to the php-fpm socket:

<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost/"
</FilesMatch>

Check that the virtual host configuration file matches the example:

<VirtualHost *:443>
ServerName passwork:443
DocumentRoot /var/www/public

<Directory /var/www/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost/"
</FilesMatch>
</VirtualHost>

Enable modules and restart services:

a2enmod rewrite proxy_fcgi setenvif
systemctl restart php8.3-fpm
systemctl restart apache2