You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/_posts/php84-on-ubuntu-2410.md
+29-4
Original file line number
Diff line number
Diff line change
@@ -16,21 +16,21 @@ As of December 2024, the Ondřej Surý PPA does not provide support for Ubuntu 2
16
16
To install PHP 8.4 on Ubuntu 24.10, you can modify the PPA's configuration to use packages from Ubuntu 24.04 (Noble). Here's how:
17
17
18
18
1.**Remove and Re-add the Ondřej Surý PPA:**
19
-
```shell
19
+
```shell
20
20
sudo add-apt-repository --remove ppa:ondrej/php
21
-
sudo add-apt-repository ppa:ondrej/php
21
+
sudo add-apt-repository ppa:ondrej/php
22
22
```
23
23
This ensures a clean configuration of the PPA.
24
24
25
25
2.**Modify the PPA's Release Suite:**
26
-
```shell
26
+
```shell
27
27
sudo sed -i 's/oracular/noble/g' /etc/apt/sources.list.d/ondrej-ubuntu-php-oracular.sources
28
28
```
29
29
This command changes the release suite from 'oracular' (24.10) to 'noble' (24.04), allowing you to access PHP packages intended for Ubuntu 24.04.
30
30
31
31
3.**Update Package Lists:**
32
32
33
-
```shell
33
+
```shell
34
34
sudo apt update
35
35
```
36
36
This refreshes your package lists to include the modified PPA configuration.
@@ -42,6 +42,31 @@ sudo apt install php8.4
42
42
```
43
43
This installs PHP 8.4 from the modified PPA.
44
44
45
+
####I have multiple PHP versions installed, what to do then?
46
+
47
+
No worries, in ubuntu you have a backed in option, so set your default PHP version. Running the command as below, you can
48
+
set your default version. If you choose auto mode, it will choose the newest version installed.
49
+
50
+
Auto mode means the system will automatically select the alternative with the highest priority. If a new version of PHP is installed with a higher priority, the system may switch to that version without manual intervention.
51
+
In the above example, PHP 7.4 is in auto mode. If you install PHP 8.2 with a priority of 100, the system will automatically switch to PHP 8.2.
52
+
53
+
```shell
54
+
sudo update-alternatives --config php
55
+
[sudo] password for tomas:
56
+
There are 6 choices for the alternative php (providing /usr/bin/php).
0 commit comments