이 문서는 php7.2 설치 문서 입니다. 1. 준비 CentOS 가 최소설치되었다고 가정하고 시작했기 때문에 컴파일 환경을 구축해야 합니다.
1 2 3 |
yum update -y reboot yum install gcc.x86_64 gcc-c++.x86_64 wget.x86_64 bzip2-devel.x86_64 pkgconfig.x86_64 openssl-devel.x86_64 make.x86_64 man.x86_64 nasm.x86_64 gmp.x86_64 gmp-devel.x86_64 curl-devel.x86_64 libicu-devel.x86_64 libsodium-devel.x86_64 gdbm-devel.x86_64 readline-devel.x86_64 compat-readline43.x86_64 ncurses-devel.x86_64 db4-devel.x86_64 automake* autoconf* -y |
Ubuntu16.04 의 경우에는 다음과 같은 프로그램이 설치되어 있어야 합니다.
1 2 3 4 5 |
apt clean all apt update apt install build-essential libsystemd-dev pkg-config libxml2-dev libssl-dev libbz2-dev \ libcurl3 libcurl4-openssl-dev libsodium-dev libjpeg9-dev libpng-dev \ libfreetype6-dev libxpm-dev libgmp10-dev libxslt1-dev |
2.Download and Unpack 최신버전을 다운로드 받아야 합니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
]# wget http://jp2.php.net/get/php-7.2.1.tar.bz2/from/this/mirror --2018-01-07 00:17:28-- http://jp2.php.net/get/php-7.2.1.tar.bz2/from/this/mirror Resolving jp2.php.net... 49.212.134.217 Connecting to jp2.php.net|49.212.134.217|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://jp2.php.net/distributions/php-7.2.1.tar.bz2 [following] --2018-01-07 00:17:29-- http://jp2.php.net/distributions/php-7.2.1.tar.bz2 Connecting to jp2.php.net|49.212.134.217|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14980278 (14M) [application/octet-stream] Saving to: `mirror' 100%[===================================================================================>] 14,980,278 6.55M/s in 2.2s 2018-01-07 00:17:31 (6.55 MB/s) - `mirror' saved [14980278/14980278] ]# tar xvjf mirror |
3. Configure and Compile 이제 PHP에서 사용할 기능들을 결정해야 합니다. PHP에서 제공하는 기능은 아주 많지만 여기서는 다음과 같은 기능들을 사용할 것입니다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
../configure --prefix=/opt/php-7.2.1 \ --with-config-file-path=/opt/php-7.2.1/etc \ --with-config-file-scan-dir=/opt/php-7.2.1/etc/conf.d \ --with-libdir=lib64 \ --enable-fpm \ --with-fpm-systemd \ --enable-sockets \ --with-gettext \ --with-mhash \ --with-gmp \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-zlib-dir=/usr \ --with-freetype-dir=/usr \ --enable-bcmath \ --enable-exif \ --with-zlib \ --with-bz2 \ --enable-calendar \ --enable-mbstring \ --with-mhash \ --enable-intl \ --with-xsl \ --with-sodium \ --with-libxml-dir=/usr \ --with-curl \ --disable-debug \ --with-openssl \ --enable-mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ --enable-inline-optimization \ --enable-sysvmsg \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-pcntl \ --enable-mbregex \ --with-mhash \ --enable-zip \ --with-pcre-regex |
아무런 에러없이 끝났다면 다음과 같이 컴파일을 해주고 설치해준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
]# make ]# make install Installing shared extensions: /opt/php-7.2.1/lib/php/extensions/no-debug-non-zts-20170718/ Installing PHP CLI binary: /opt/php-7.2.1/bin/ Installing PHP CLI man page: /opt/php-7.2.1/php/man/man1/ Installing PHP FPM binary: /opt/php-7.2.1/sbin/ Installing PHP FPM defconfig: /opt/php-7.2.1/etc/ Installing PHP FPM man page: /opt/php-7.2.1/php/man/man8/ Installing PHP FPM status page: /opt/php-7.2.1/php/php/fpm/ Installing phpdbg binary: /opt/php-7.2.1/bin/ Installing phpdbg man page: /opt/php-7.2.1/php/man/man1/ Installing PHP CGI binary: /opt/php-7.2.1/bin/ Installing PHP CGI man page: /opt/php-7.2.1/php/man/man1/ Installing build environment: /opt/php-7.2.1/lib/php/build/ Installing header files: /opt/php-7.2.1/include/php/ Installing helper programs: /opt/php-7.2.1/bin/ program: phpize program: php-config Installing man pages: /opt/php-7.2.1/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /opt/php-7.2.1/lib/php/ [PEAR] Archive_Tar - installed: 1.4.3 [PEAR] Console_Getopt - installed: 1.4.1 [PEAR] Structures_Graph- installed: 1.1.1 [PEAR] XML_Util - installed: 1.4.2 [PEAR] PEAR - installed: 1.10.5 Wrote PEAR system config file at: /opt/php-7.2.1/etc/pear.conf You may want to add: /opt/php-7.2.1/lib/php to your php.ini include_path /root/php-7.2.1/build/shtool install -c ext/phar/phar.phar /opt/php-7.2.1/bin ln -s -f phar.phar /opt/php-7.2.1/bin/phar Installing PDO headers: /opt/php-7.2.1/include/php/ext/pdo/ |
4. Configure to the installed php7 config-file-scan 디렉토리를 생성해 준다.
1 |
]# mkdir /opt/php-7.2.1/etc/conf.d |
[…]