Skip to content

Commit 30eb407

Browse files
committed
chore: update PHP8.4 with suggestion from Matt Setter
1 parent 098f2b4 commit 30eb407

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

Diff for: source/_posts/php84-on-ubuntu-2410.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ As of December 2024, the Ondřej Surý PPA does not provide support for Ubuntu 2
1616
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:
1717

1818
1. **Remove and Re-add the Ondřej Surý PPA:**
19-
```shell
19+
```shell
2020
sudo add-apt-repository --remove ppa:ondrej/php
21-
sudo add-apt-repository ppa:ondrej/php
21+
sudo add-apt-repository ppa:ondrej/php
2222
```
2323
This ensures a clean configuration of the PPA.
2424

2525
2. **Modify the PPA's Release Suite:**
26-
```shell
26+
```shell
2727
sudo sed -i 's/oracular/noble/g' /etc/apt/sources.list.d/ondrej-ubuntu-php-oracular.sources
2828
```
2929
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.
3030

3131
3. **Update Package Lists:**
3232

33-
```shell
33+
```shell
3434
sudo apt update
3535
```
3636
This refreshes your package lists to include the modified PPA configuration.
@@ -42,6 +42,31 @@ sudo apt install php8.4
4242
```
4343
This installs PHP 8.4 from the modified PPA.
4444

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).
57+
58+
Selection Path Priority Status
59+
------------------------------------------------------------
60+
0 /usr/bin/php8.4 84 auto mode
61+
1 /usr/bin/php7.4 74 manual mode
62+
2 /usr/bin/php8.0 80 manual mode
63+
3 /usr/bin/php8.1 81 manual mode
64+
4 /usr/bin/php8.2 82 manual mode
65+
* 5 /usr/bin/php8.3 83 manual mode
66+
6 /usr/bin/php8.4 84 manual mode
67+
```
68+
69+
4570
**Important Considerations:**
4671

4772
* Compatibility: Using packages from a different Ubuntu release can lead to compatibility issues. Proceed with caution and test thoroughly.

0 commit comments

Comments
 (0)