|
Installing from packages on Alpine LinuxWhile PHP can be installed from source, it is also available through packages on Alpine Linux and derivatives that use the apk package manager. 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 apk package manager. Installing packages
PHP packages in Alpine Linux include the major version number in their name
(e.g. Before installing a package, ensure the package index is up to date by running apk update. Example #1 Alpine Install Example # apk add php83
Alpine does not configure PHP for a web server automatically.
For FastCGI setups, install Example #2 Enabling and starting PHP-FPM # apk add php83-fpm # rc-update add php-fpm83 default # rc-service php-fpm83 start Better control of configurationOnly the core extensions are installed with the base package. Additional extensions such as can be installed as separate packages.Example #3 Searching for available PHP packages # apk search php83 The list of packages includes the CLI, FPM, and many extensions. When extensions are installed, their dependencies are automatically resolved. Example #4 Install PHP with MySQL, GD # apk add php83-mysqli php83-gd Extensions are automatically enabled when installed; no manual php.ini editing is required. Configuration files are placed in /etc/php83/conf.d/. After installing new extensions, PHP-FPM (or the web server) needs to be restarted for the changes to take effect. |