Learn how to – How To Install PHP on Arch Linux and Manjaro.
This is a walkthrough guide on installing PHP on Arch Linux and Manjaro. PHP 8.0 has been released with plenty of new features, bug fixes, performance improvement, deprecations as well as new functionalities. PHP is a popular programming language used widely in creation on web applications. Most powerful Content Management Platforms such as WordPress and Joomla are written in PHP.
I have written guides for installing PHP on Ubuntu, Debian and CentOS server but the missing piece was for Arch Linux and Manjaro. I use Arch Linux on my Laptop and today I want to install PHP 8.2 and extensions that I require into it.
Install PHP on Arch Linux and Manjaro
We all know Arch Linux and Manjaro are rolling release Linux Distributions. This means its users often get
Update OS keys
sudo pacman -Sy archlinux-keyring
sudo pacman-key --populate archlinux
To start, update your system
sudo pacman -Syu
Agree to updates
...
Total Download Size: 298.69 MiB
Total Installed Size: 726.39 MiB
Net Upgrade Size: 9.07 MiB
:: Proceed with installation? [Y/n] y
Once the system is up-to-date, install PHP Install PHP on by running the command.
$ sudo pacman -S php
resolving dependencies...
looking for conflicting packages...
Packages (3) libzip-1.9.2-1 oniguruma-6.9.8-1 php-8.2.1-1
Total Download Size: 4.91 MiB
Total Installed Size: 28.08 MiB
:: Proceed with installation? [Y/n] y
:: Retrieving packages...
php-8.2.1-1-x86_64 4.5 MiB 4.74 MiB/s 00:01 [########################################################################] 100%
libzip-1.9.2-1-x86_64 238.5 KiB 1519 KiB/s 00:00 [########################################################################] 100%
oniguruma-6.9.8-1-x86_64 216.9 KiB 1417 KiB/s 00:00 [########################################################################] 100%
Total (3/3) 4.9 MiB 3.60 MiB/s 00:01 [########################################################################] 100%
(3/3) checking keys in keyring [########################################################################] 100%
(3/3) checking package integrity [########################################################################] 100%
(3/3) loading package files [########################################################################] 100%
(3/3) checking for file conflicts [########################################################################] 100%
(3/3) checking available disk space [########################################################################] 100%
:: Processing package changes...
(1/3) installing libzip [########################################################################] 100%
(2/3) installing oniguruma [########################################################################] 100%
(3/3) installing php [########################################################################] 100%
:: Running post-transaction hooks...
(1/1) Arming ConditionNeedsUpdate...
Verify PHP version installed.
$ php -v
PHP 8.2.1 (cli) (built: Jan 4 2023 16:37:54) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies
You can see from the output we have PHP 8.x installed. If you’re doing this installation at a later date, the minor release version may differ.
Install PHP Extensions
The extensions for PHP can be installed by appending extension name to php-
. See example below which install the basic PHP extensions I require for my development and applications hosting.
sudo pacman -S php-apache php-cgi php-fpm php-gd php-embed php-intl php-redis php-snmp
Agree to the installations prompts:
...
Total Download Size: 35.66 MiB
Total Installed Size: 200.39 MiB
Net Upgrade Size: 173.59 MiB
:: Proceed with installation? [Y/n] y
You can see package details using pacman -Qi
$ pacman -Qi php-fpm
Name : php-fpm
Version : 8.2.1-1
Description : FastCGI Process Manager for PHP
Architecture : x86_64
URL : https://www.php.net/
Licenses : PHP
Groups : None
Provides : None
Depends On : php systemd
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 18.07 MiB
Packager : Pierre Schmitz <pierre@archlinux.org>
Build Date : Wed Jan 4 16:37:54 2023
Install Date : Wed Jan 25 08:41:05 2023
Install Reason : Explicitly installed
....
Enjoy your Development with PHP on Arch Linux and Manjaro.
Reference: https://wiki.archlinux.org/index.php/PHP
Leave a Reply
You must be logged in to post a comment.