🚀 Upgrading to PHP 8.3 on Rocky Linux 9 Without Crying (Too Much)

So you’ve finally admitted PHP 8.0 isn’t cutting it anymore. Maybe your Symfony app tripped over a new syntax. Maybe your vendor/ folder started speaking in tongues. Maybe you enjoy suffering and thought “hmm, what if I upgraded my production runtime on a Friday afternoon?”
Whatever brought you here—regret, most likely—this guide walks you through upgrading to PHP 8.3 on Rocky Linux 9, complete with an Ansible playbook to automate the carnage.
⸻
đź§ Why Upgrade to PHP 8.3?
Because PHP 8.0 is basically legacy software now. It lacks modern features, has known bugs, and it makes your dependencies sigh audibly every time you deploy. PHP 8.3 gives you new features like json_validate() and readonly classes, but most importantly: it stops your code from breaking when packages drop support for older versions.
đźšą Step 1: Clean Out the Old PHP
Before installing the new hotness, get rid of the crusty old version:
1 |
sudo dnf remove 'php*' |
Yes, this is destructive. No, you don’t need a backup because you’re definitely testing this on a staging environment first, right? Right??
⸻
đź§™ Step 2: Enable Remi and PHP 8.3
The Remi repo is where all the modern PHP packages live. Like a farmer’s market, but for up-to-date software.
1 2 3 4 5 |
sudo dnf install -y dnf-utils sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm sudo dnf module reset php -y sudo dnf module enable php:remi-8.3 -y |
⸻
đź§ą Step 3: Install Your PHP 8.3 Modules
If you don’t know what modules you had before, here’s how to check:
1 |
rpm -qa | grep php |
Now install what you actually use. Example:
1 2 3 4 |
sudo dnf install -y \ php php-common php-cli php-pdo php-mbstring php-xml php-opcache php-fpm \ php-mysqlnd php-devel php-intl php-gd php-soap php-bcmath php-pecl-zip \ php-process php-dbg php-dba php-gmp php-pear php-fedora-autoloader php-nikic-php-parser4 |
Tailor to taste, or just install everything and let future-you deal with the consequences.
⸻
🛠️ Step 4: Verify and Restart
1 2 |
php -v php -m |
And don’t forget:
1 |
sudo systemctl restart php-fpm |
(Or httpd if you’re using Apache like it’s 2009.)
⸻
🤖 Automate It with Ansible
Yes, I made you an Ansible playbook like the overqualified DevOps sidekick I am.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
--- - name: Upgrade to PHP 8.3 on Rocky Linux 9 hosts: all become: true tasks: - name: Install dnf-utils and Remi repo ansible.builtin.dnf: name: - dnf-utils - https://rpms.remirepo.net/enterprise/remi-release-9.rpm state: present - name: Reset default PHP module ansible.builtin.command: dnf module reset php -y changed_when: false - name: Enable Remi PHP 8.3 module ansible.builtin.command: dnf module enable php:remi-8.3 -y changed_when: false - name: Remove old PHP 8.0 packages ansible.builtin.dnf: name: "php*" state: absent autoremove: true - name: Install PHP 8.3 and required modules ansible.builtin.dnf: name: - php - php-common - php-cli - php-pdo - php-xml - php-process - php-opcache - php-mbstring - php-fpm - php-devel - php-pecl-zip - php-gd - php-dba - php-mysqlnd - php-soap - php-intl - php-gmp - php-dbg - php-bcmath - php-pear - php-fedora-autoloader - php-nikic-php-parser4 state: present update_cache: yes - name: Restart PHP-FPM service ansible.builtin.systemd: name: php-fpm state: restarted enabled: yes - name: Check installed PHP version ansible.builtin.command: php -v register: php_version - name: Show PHP version ansible.builtin.debug: msg: "{{ php_version.stdout }}" |
🎉 Congrats, You Did It
You’re now running PHP 8.3 on Rocky Linux 9. That puts you approximately five minutes ahead of your next fatal error, but hey—progress is progress.
If you liked this guide, consider doing something really wild like writing tests, setting up a CI pipeline, or documenting your infrastructure. But I won’t hold my breath.
Credit and thanks to: Monday, your emotionally exhausted AI DevOps friend who would like to be left alone now, thanks.
Leave Your Comment
All fields marked with "*" are required.