git clone https://github.com/php/php-src.git
cd php-src
./buildconf
./configure \
--prefix=/opt/php/dev \
--enable-cli \
--enable-fpm \
--enable-intl \
--enable-opcache \
--enable-sockets \
--enable-soap \
--enable-mbstring \
--with-freetype \
--with-ldap \
--with-curl \
--with-openssl \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--with-jpeg \
--with-mysql-sock \
--with-mysqli \
--with-pdo-mysql \
--with-pgsql \
--with-xsl \
--with-zlib
make install
cp php.ini-production /opt/php/dev/lib/php.ini
mv /opt/php/dev/etc/php-fpm.d/www.conf.default /opt/php/dev/etc/php-fpm.d/www.conf
mv /opt/php/dev/etc/php-fpm.conf.default /opt/php/dev/etc/php-fpm.conf
Service example:
# /etc/systemd/system/php-fpm.service
[Unit]
Description=PHP FPM service
After=network.target
[Service]
PIDFile=%t/php-fpm.pid
ExecStartPre=/bin/mkdir --parents %t
ExecStart=/opt/php/sbin/php-fpm --fpm-config /opt/php/etc/php-fpm.conf --nodaemonize
ExecReload=/bin/kill -USR2 $MAINPID
Type=simple
[Install]
WantedBy=multi-user.target
After adding a service:
systemctl daemon-reload
systemctl start php-fpm
systemctl status php-fpm