Installing from packages on Arch Linux
While PHP can be installed from source, it is also available through
packages on Arch Linux and derivatives that use pacman.
Warning
Builds from third-parties are considered unofficial and not directly
supported by the PHP project. Any bugs encountered should be reported to the
provider of those unofficial builds unless they can be reproduced using the
builds from » the official download
area.
The packages can be installed using the pacman command.
Installing packages
First, note that other related packages may be desired, such as
php-apache for Apache,
or php-fpm for FastCGI setups.
Before installing a package, it is recommended to ensure the system
is up to date. Typically, this is done by running the command
pacman -Syu.
Example #1 Pacman Install Example with Apache
# pacman -S php php-apache
Pacman will automatically install all dependencies for PHP.
The web server may need to be restarted in order for the changes to
take effect. For example:
Example #2 Restarting Apache once PHP is installed
# systemctl restart httpd
Better control of configuration
In the last section, PHP was installed with only core modules. It is
very likely that additional modules will be desired, such as
MySQL, cURL, GD, etc.
These may also be installed via the pacman command.
Example #3 Methods for listing additional PHP packages
The list of packages will include a number of packages that includes
PHP extensions such as php-gd,
php-intl, php-sqlite, and others.
When extensions are installed, additional packages
will be automatically installed as necessary to satisfy the dependencies
of those packages.
Example #4 Install PHP with GD
After installing an extension package, the corresponding entry in
/etc/php/php.ini must be uncommented to enable it.
For example, after installing php-gd, uncomment the line
extension=gd in /etc/php/php.ini.
Restarting the web server (like Apache) is required before these
changes take effect.