OSETC TECH

How to Install PHP7 fpm in Alpine Linux

This post will guide you how to install PHP7 fpm and other PHP modules On a Alpine Linux. How do I install the php7 modules on your Alpine Linux Docker VM.

Installing PHP7 fpm


To install PHP7 fpm on your Alpine Linux, and you need to use the following apk command:

# apk add php7 php7-fpm php7-opcache

Outputs:

/ # apk add php7 php7-fpm php7-opcache
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
(1/8) Installing php7-common (7.3.9-r0)
(2/8) Installing argon2-libs (20171227-r2)
(3/8) Installing libedit (20190324.3.1-r0)
(4/8) Installing pcre2 (10.33-r0)
(5/8) Installing libxml2 (2.9.9-r2)
(6/8) Installing php7 (7.3.9-r0)
(7/8) Installing php7-fpm (7.3.9-r0)
(8/8) Installing php7-opcache (7.3.9-r0)
Executing busybox-1.30.1-r2.trigger
OK: 35 MiB in 36 packages

Once php7-fpm is installed on your system, and you need to restart Nginx and php7-fpm service with the following command:

# rc-service nginx restart
# rc-service php-fpm7 start

Installing PHP7 modules


If you want to install other php7 modules on your Alpine Linux, such as: php7-gd, php7-mysqli, php7-zlib or php7-curl, just issuing the following command:

# apk add php7-gd php7-mysqli php7-zlib php7-curl

Outputs:

/ # apk add php7-gd php7-mysqli php7-zlib php7-curl
(1/24) Installing ca-certificates (20190108-r0)
(2/24) Installing nghttp2-libs (1.39.2-r0)
(3/24) Installing libcurl (7.66.0-r0)
(4/24) Installing php7-curl (7.3.9-r0)
(5/24) Installing libxau (1.0.9-r0)
(6/24) Installing libbsd (0.9.1-r0)
(7/24) Installing libxdmcp (1.1.3-r0)
(8/24) Installing libxcb (1.13.1-r0)
(9/24) Installing libx11 (1.6.8-r1)
(10/24) Installing libxext (1.3.4-r0)
(11/24) Installing libice (1.0.9-r3)
(12/24) Installing libuuid (2.33.2-r0)
(13/24) Installing libsm (1.2.3-r0)
(14/24) Installing libxt (1.1.5-r2)
(15/24) Installing libxpm (3.5.12-r0)
(16/24) Installing libbz2 (1.0.6-r7)
(17/24) Installing libpng (1.6.37-r1)
(18/24) Installing freetype (2.10.0-r0)
(19/24) Installing libjpeg-turbo (2.0.2-r0)
(20/24) Installing libwebp (1.0.2-r0)
(21/24) Installing php7-gd (7.3.9-r0)
(22/24) Installing php7-openssl (7.3.9-r0)
(23/24) Installing php7-mysqlnd (7.3.9-r0)
(24/24) Installing php7-mysqli (7.3.9-r0)
Executing busybox-1.30.1-r2.trigger
Executing ca-certificates-20190108-r0.trigger
OK: 45 MiB in 60 packages

Searching All Available PHP7 Modules


If you want to search all available php7 moduels in your Alpine Linux, you can use apk search command with a pattern, such as: php7. type:

# apk search php7

Outputs:

/ # apk search php7
php7-intl-7.3.9-r0
php7-openssl-7.3.9-r0
php7-dba-7.3.9-r0
php7-sqlite3-7.3.9-r0
php7-pear-7.3.9-r0
php7-tokenizer-7.3.9-r0
php7-phpdbg-7.3.9-r0
php7-pecl-imagick-dev-3.4.4-r1
cacti-php7-1.2.3-r0
php7-pecl-protobuf-3.8.0-r1
xapian-bindings-php7-1.4.11-r2
php7-litespeed-7.3.9-r0
php7-gmp-7.3.9-r0
php7-phalcon-3.4.3-r2
php7-pdo_mysql-7.3.9-r0
php7-sodium-7.3.9-r0
php7-pcntl-7.3.9-r0
php7-common-7.3.9-r0
php7-pecl-oauth-2.0.3-r2
php7-xsl-7.3.9-r0
php7-7.3.9-r0
php7-fpm-7.3.9-r0
php7-pecl-mailparse-3.0.3-r1
php7-pecl-gmagick-2.0.5_rc1-r5
php7-pecl-imagick-3.4.4-r1
php7-mysqlnd-7.3.9-r0
php7-enchant-7.3.9-r0
php7-pspell-7.3.9-r0
php7-pecl-ast-1.0.1-r1
php7-pecl-redis-4.3.0-r2
php7-snmp-7.3.9-r0
php7-doc-7.3.9-r0
php7-fileinfo-7.3.9-r0
php7-mbstring-7.3.9-r0
php7-pecl-lzf-1.6.7-r1
php7-pecl-amqp-1.9.4-r1
php7-pecl-yaml-2.0.4-r1
php7-pecl-timezonedb-2019.1-r3
php7-dev-7.3.9-r0
php7-pear-mail_mime-1.10.2-r1
php7-xmlrpc-7.3.9-r0
php7-embed-7.3.9-r0
php7-xmlreader-7.3.9-r0
php7-pear-mdb2_driver_mysql-1.5.0b4-r0
php7-pdo_sqlite-7.3.9-r0
php7-pear-auth_sasl2-0.2.0-r1
php7-exif-7.3.9-r0
php7-pecl-msgpack-2.0.3-r2
php7-recode-7.3.9-r0
php7-opcache-7.3.9-r0
php7-ldap-7.3.9-r0
php7-posix-7.3.9-r0
php7-pear-net_socket-1.2.2-r0
php7-session-7.3.9-r0
php7-gd-7.3.9-r0
php7-pecl-xdebug-2.7.2-r1
php7-gettext-7.3.9-r0
php7-pecl-couchbase-2.6.1-r1
php7-json-7.3.9-r0
php7-xml-7.3.9-r0
php7-iconv-7.3.9-r0
php7-sysvshm-7.3.9-r0
php7-curl-7.3.9-r0
php7-shmop-7.3.9-r0
php7-odbc-7.3.9-r0
php7-phar-7.3.9-r0
php7-pdo_pgsql-7.3.9-r0
php7-imap-7.3.9-r0
php7-pecl-apcu-5.1.17-r1
php7-pear-mdb2_driver_pgsql-1.5.0b4-r0
php7-pdo_dblib-7.3.9-r0
php7-pgsql-7.3.9-r0
php7-pdo_odbc-7.3.9-r0
php7-pecl-igbinary-3.0.1-r1
php7-zip-7.3.9-r0
php7-apache2-7.3.9-r0
php7-cgi-7.3.9-r0
php7-ctype-7.3.9-r0
php7-pecl-mcrypt-1.0.2-r1
php7-wddx-7.3.9-r0
php7-pear-net_smtp-1.8.1-r0
php7-bcmath-7.3.9-r0
php7-calendar-7.3.9-r0
php7-tidy-7.3.9-r0
php7-dom-7.3.9-r0
php7-sockets-7.3.9-r0
php7-pecl-zmq-1.1.3-r6
php7-pecl-event-2.5.3-r0
php7-pecl-vips-1.0.9-r2
php7-pecl-memcached-3.1.3-r2
php7-brotli-0.7.0-r1
unit-php7-1.8.0-r3
php7-soap-7.3.9-r0
php7-sysvmsg-7.3.9-r0
php7-pecl-ssh2-1.1.2-r5
php7-ftp-7.3.9-r0
php7-sysvsem-7.3.9-r0
php7-pear-net_idna2-0.2.0-r1
php7-pdo-7.3.9-r0
php7-pear-auth_sasl-1.1.0-r1
php7-bz2-7.3.9-r0
php7-mysqli-7.3.9-r0
php7-pear-net_smtp-doc-1.8.1-r0
php7-pear-net_sieve-1.4.4-r0
php7-simplexml-7.3.9-r0
php7-xmlwriter-7.3.9-r0
/ #

Conclusion


You should know that how to install php7 fpm and other php7 modules in your Alpine Linux.