PHP-FPM 7.4.6 source install with openssl on CentOS8
Centos8에서 PHP-FPM 7.4.6 & openssl 1.1.1g를 source 설치를 기술합니다.
Enviroment
OS : CentOS 8.1
PHP : 7.4.6
Openssl : 1.1.1g
openssl 설치는 아래의 글을 참고하시면 됩니다.
https://umount.net/openssl-1-1-1g-source-install-on-centos8/
1. Default Enviroment Setting
$sudo dnf install tar wget $sudo mkdir -p /usr/local/IDC/Src $sudo mkdir -p /usr/local/IDC/Download $sudo mkdir -p /usr/local/IDC/Service $sudo mkdir -p /usr/local/IDC/Data
$sudo dnf install autoconf libtool bison libxml2-devel bzip2-devel libcurl-devel gcc-c++ sqlite-devel gd-devel gettext-devel curl-devel freetype-devel libjpeg-devel openldap-devel libldb-devel
3. Symbolic link libldap.so & liblber.so ( php ldap 기능을 사용할 때만 설치 )
$sudo ln -s /usr/lib64/libldap.so /usr/lib/ $sudo ln -s /usr/lib64/liblber.so /usr/lib/
4. Preinstall oniguruma ( php mbstring 기능을 사용할 때만 설치 )
PHP 7.4.6을 설치하기 위해서는 oniguruma의 설치가 필요하지만 CentOS8의 기본 버전이 낮아서 상위 버전으로 설치해 줍니다.
$sudo cd /usr/local/IDC/Download
$sudo wget https://github.com/kkos/oniguruma/archive/v6.9.5.tar.gz -O oniguruma-6.9.5.tar.gz $sudo tar xpfvz oniguruma-6.9.5.tar.gz $sudo cd oniguruma-6.9.5 $sudo ./autogen.sh $sudo ./configure --prefix=/usr $sudo make $sudo make install
5. Download & Install
$sudo cd /usr/local/IDC/Download
$sudo curl -O https://www.php.net/distributions/php-7.4.6.tar.gz $sudo tar xfvpz php-7.4.6.tar.gz $sudo cd php-7.4.6 $sudo ./configure --prefix=/usr/local/IDC/Src/php-7.4.6 --enable-fpm --with-openssl=/usr/local/IDC/Download/openssl-1.1.1g --with-zlib --enable-mysqlnd --without-sqlite3 --enable-gd --enable-bcmath --enable-sockets --enable-mbstring --with-gettext --with-mysqli --with-curl -with-freetype --with-jpeg --with-ldap $sudo make -j$(nproc) $sudo make install $sudo cp /usr/local/IDC/Download/php-7.4.6/php.ini-production /usr/local/IDC/Src/php-7.4.6/etc/php.ini
6. Symbolic directory
$sudo cd /usr/local/IDC/Service/ $sudo ln -s /usr/local/IDC/Src/php-7.4.6/ /usr/local/IDC/Service/php
7. Create nginx systemd
vi /etc/systemd/system/php-fpm.service
[Unit] Description=The PHP FastCGI Process Manager After=syslog.target network.target [Service] Type=simple Environment=LD_LIBRARY_PATH=/usr/local/IDC/Service/openssl/lib PIDFile=/var/run/php-fpm.pid ExecStart=/usr/local/IDC/Service/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/IDC/Service/php/etc/php-fpm.conf ExecReload=/bin/kill -USR2 $MAINPID [Install] WantedBy=multi-user.target
8. Enable nginx & Start
$sudo systemctl enable php-fpm.service $sudo systemctl start php-fpm.service