Repo news with Ubuntu 24.04 LTS

Ubuntu 24.04 introduced a new way to specify repos.

See https://askubuntu.com/questions/1514281/ubuntu-24-04-apt-specify-architecture-using-sources-files for more info!

Except for the parameters listed on the above link, you may want to make a note of these ones as well.

Architectures: amd64
Enabled: yes|no
Signed-By: /usr/share/keyrings/some-keyring.gpg|hash-block[1]

[1] As specified eg here; https://github.com/NVIDIA/nvidia-container-toolkit/issues/774.

 

 

Notes on adding more php support to Ubuntu Server

Make sure you run an apt update && apt upgrade before adding this repo.

Reboot as needed.

 

Adding the repo

$ sudo add-apt-repository ppa:ondrej/php

Check the contents of /etc/apt/sources.list.d/ondrej-ubuntu-php-noble.sources (note the file-extension; .sources - before it was .list) and make sure the distro name is proper. Ie Ubuntu 24.04 should have noble in the mentioned repo file.

 

Upgrade Php from eg 8.1 to 8.2

$ sudo apt install php8.2

 

Don't forget to add any missing php modules to php 8.2, that are available in php 8.1 for your use case!

 

Switch the php versions

Check current (active) php version and then switch them.

$ php -v
$ sudo update-alternatives --config php

Choose either 0 for auto mode or eg 1 for a php version that won't get changed at the next upgrade. In this case choose 2 and press enter.

 

root@server:~# update-alternatives --config php
There are 2 choices for the alternative php (providing /usr/bin/php).

Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/php8.2 82 auto mode
* 1 /usr/bin/php8.1 81 manual mode
2 /usr/bin/php8.2 82 manual mode

Press <enter> to keep the current choice[*], or type selection number:


Now run php -v again to check that the correct php version is active.

root@server:~# php -v
PHP 8.2.13 (cli) (built: Nov 24 2023 08:47:18) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.13, Copyright (c) Zend Technologies
with Zend OPcache v8.2.13, Copyright (c), by Zend Technologies

Finally, check your web sites that they appear correctly with the new php version!

 

Apache2 php.ini settings

Default settings are usually okay, but I use these. Find the php.ini in /etc/php/8.2/apache2.

 

$ nano /etc/php/8.2/apache2/php.ini

memory_limit = 2048M
post_max_size = 160M
upload_max_filesize = 160M
max_execution_time = 60

 

Don't forget to save your php.ini!

 

And with that, we're done.

 

 

Sources

https://launchpad.net/~ondrej/+archive/ubuntu/php

https://dev.to/pallade/ppaondrejphp-on-ubuntu-2304-lunar-ia1

https://tecadmin.net/how-to-install-php-on-ubuntu-22-04/

https://stackoverflow.com/questions/42619312/switch-php-versions-on-commandline-ubuntu-16-04

https://askubuntu.com/questions/1514281/ubuntu-24-04-apt-specify-architecture-using-sources-files

https://github.com/NVIDIA/nvidia-container-toolkit/issues/774

 

 

 

 

 

 

 

 

 

 

 

Stop Spam Harvesters, Join Project Honey Pot

 

Get a free SSL certificate!

 

The leading nonprofit defending digital privacy, free speech, and innovation.

 

The Linux Foundation provides a neutral, trusted hub for developers and organizations to code, manage, and scale open technology projects and ecosystems.

 

Kubuntu is an operating system built by a worldwide community of developers, testers, supporters and translators.

 

 43ef5c89 CanonicalUbuntudarktext