大网数据广告活动
PHP 语言与运行手册

Installing from packages on Arch Linux

· 52CE 我爱测

While PHP can be installed from source, it is also available through packages on Arch Linux and derivatives that use pacman.

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

# pacman -Ss php

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

# pacman -S php-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.

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。