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.0 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 latest software updates before users using non-rolling Linux distributions do. For this, the default version of PHP available on Arch Linux and Manjaro repositories is 8.0.

To start, update your system

sudo pacman -Syu

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.7.3-2  oniguruma-6.9.7.1-1  php-8.0.8-1

Total Download Size:    4.45 MiB
Total Installed Size:  25.34 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
 libzip-1.7.3-2-x86_64                                                228.3 KiB   683 KiB/s 00:00 [#########################################################] 100%
 oniguruma-6.9.7.1-1-x86_64                                           220.3 KiB  2.59 MiB/s 00:00 [#########################################################] 100%
 php-8.0.8-1-x86_64                                                     4.0 MiB  23.2 MiB/s 00:00 [#########################################################] 100%
 Total (3/3)                                                            4.5 MiB  6.65 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.0.8 (cli) (built: Jun 29 2021 16:09:21) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies

You can see from the output we have PHP 8.0.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-imap  php-redis php-snmp

Agree to the installations prompts:

...
Packages (47) aom-3.1.1-1  apache-2.4.48-1  apr-1.7.0-3  apr-util-1.6.1-8  c-client-2007f-11  dav1d-0.9.0-1  fontconfig-2:2.13.94-1  freetype2-2.10.4-1
              gd-2.3.2-4  giflib-5.2.1-2  graphite-1:1.3.14-1  harfbuzz-2.8.2-1  libavif-0.9.2-1  libde265-1.0.8-1  libheif-1.12.0-1  libice-1.0.10-3
              libjpeg-turbo-2.1.0-1  liblzf-3.6-2  libpng-1.6.37-3  libsm-1.2.3-2  libtiff-4.3.0-1  libwebp-1.2.0-1  libx11-1.7.2-1  libxau-1.0.9-3
              libxcb-1.14-1  libxdmcp-1.1.3-3  libxext-1.3.4-3  libxpm-3.5.13-2  libxt-1.2.1-1  libyuv-r2212+dfaf7534-2  lm_sensors-1:3.6.0.r41.g31d1f125-1
              net-snmp-5.9.1-1  php-igbinary-3.2.3-1  rav1e-0.4.1-1  svt-av1-0.8.7-1  x265-3.5-1  xcb-proto-1.14.1-3  xorgproto-2021.4-1  php-apache-8.0.8-1
              php-cgi-8.0.8-1  php-embed-8.0.8-1  php-fpm-8.0.8-1  php-gd-8.0.8-1  php-imap-8.0.8-1  php-intl-8.0.8-1  php-redis-5.3.4-1  php-snmp-8.0.8-1

Total Download Size:    31.62 MiB
Total Installed Size:  159.27 MiB

:: Proceed with installation? [Y/n] y

You can see package details using pacman -Qi

$ pacman -Qi php-fpm
Name            : php-fpm
Version         : 8.0.8-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  : 16.07 MiB
Packager        : Pierre Schmitz <[email protected]>
Build Date      : Tue Jun 29 16:09:21 2021
Install Date    : Mon Jul 12 23:28:29 2021
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

Enjoy your Development with PHP on Arch Linux and Manjaro.

PHP Web Programming Video Courses:

Reference: https://wiki.archlinux.org/index.php/PHP

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!


As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.

LEAVE A REPLY

Please enter your comment!
Please enter your name here