Php

php7-fpm 설치

techapi 2025. 3. 10. 13:45
반응형

 

yum install openssl-devel libxml2-devel curl curl-devel libxml2-devel libjpeg-devel libpng-devel freetype-devel libicu libicu-devel gcc-c++ postgresql-devel libxslt-devel mysql-devel libtool pcre pcre-devel lua-devel sqlite-devel libonig-dev oniguruma-devel openldap gmp-devel bzip2-devel readline-devel php-pecl-zip libwebp-devel

 

1. 소스 다운로드

http://mirror.cogentco.com/pub/php/php-7.4.29.tar.gz

 

ln -s /usr/lib64/libldap.so /usr/lib/libldap.so

ln -s /usr/lib64/libldap_r.so /usr/lib/libldap_r.so

 ln -s /usr/lib64/liblber.so /usr/lib/liblber.so

 

export LDFLAGS=-llber

 

2. php-fpm configure

https://jiniya.pe.kr/bbs/board.php?bo_table=pgtip&wr_id=29

 

https://www.uxlinux.com/install-php-7-4-on-cwp-control-panel-manual-installation-guide/

 

 

./configure   --prefix=/usr/local/php-7.4.29 --with-config-file-path=/usr/local/php-7.4.29 --enable-fpm --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-curl --with-iconv --with-gmp --enable-gd --with-freetype --with-jpeg --with-webp --with-zlib-dir --with-freetype --enable-gd-jis-conv --with-openssl --with-pdo-mysql=shared --with-gettext=/usr --with-zlib=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-intl --enable-phar --with-xsl --with-xmlrpc --with-kerberos --enable-posix --enable-sockets  --enable-calendar --with-libdir=lib64 --with-libxml --with-mysql-sock=/var/lib/mysql/mysql.sock

  

make

make install

 

3. 설정 복사

 

cp php.ini-production /usr/local/php-7.4.29/php.ini

cp /usr/local/php-7.4.29/etc/php-fpm.conf.default /usr/local/php-7.4.29/etc/php-fpm.conf

cp /usr/local/php-7.4.29/etc/php-fpm.d/www.conf.default /usr/local/php-7.4.29/etc/php-fpm.d/www.conf

cp sapi/fpm/init.d.php-fpm /usr/local/php-7.4.29/bin/php-fpmctl

chmod 700 /usr/local/php-7.4.29/bin/php-fpmctl

 

ln -s /usr/local/php-7.4.29/bin/php-fpmctl /etc/rc.d/init.d/php-fpmctl70

chkconfig php-fpmctl70 on

service php-fpmctl70 start

 

 

4. php.ini path 확인

 

/usr/local/php-7.4.29/bin/php --ini | grep php.ini

→ 위치에 php.ini 있어야

 

pdo_mysql.default_socket=/var/lib/mysql/mysql.sock

mysqli.default_socket =/var/lib/mysql/mysql.sock

 

1.1.5. httpd.conf (wordpress 예)

 

<VirtualHost *:80>

    DocumentRoot /data/domain/wordpress/

    ServerName www.domaincom

    ErrorLog "|/usr/sbin/rotatelogs -l /etc/httpd/logs/doamin.%Y%m%d.log 86400"

    CustomLog "|/usr/sbin/rotatelogs -l /etc/httpd/logs/domain.%Y%m%d.log 86400" combined

    <Directory /data/domain/wordpress/>

          Require all granted

    </Directory>

    ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/data/domain/wordpress/$1

    AddDefaultCharset UTF-8

    Header always append X-Frame-Options SAMEORIGIN

    Header always set X-Content-Type-Options "nosniff"

    Header always set X-Xss-Protection "1; mode=block"

</VirtualHost>

 

 

반응형

'Php' 카테고리의 다른 글

AWS php7 설치  (0) 2025.03.10
php7 설치  (0) 2025.03.10