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.
While PHP can be installed from source, it is also available through packages on Arch Linux and derivatives that use pacman.
Third-party-support
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.
Pacman Install Example with Apache
# pacman -S php php-apachePacman 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:
Restarting Apache once PHP is installed
# systemctl restart httpdBetter 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
These may also be installed via the pacman command.
Methods for listing additional PHP packages
# pacman -Ss phpThe 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.
Install PHP with GD
# pacman -S php-gdAfter 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.