OS/Linux

Ubuntu 20.04 : PHP7.4.12 수동설치

파란크리스마스 2020. 11. 23. 02:02
728x90

출처

컴파일 관련 라이브러리 설치

$ sudo apt install pkg-config libxml2-dev libsqlite3-dev libgmp-dev libonig-dev libbz2-dev libreadline-dev libxslt1-dev

php 컴파일

pi@Kubuntu:/bluesanta$ cd /bluesanta/
pi@Kubuntu:/bluesanta$ wget https://www.php.net/distributions/php-7.4.12.tar.gz
pi@Kubuntu:/bluesanta$ tar xvfz php-7.4.12.tar.gz 
pi@Kubuntu:/bluesanta$ cd php-7.4.12/
pi@Kubuntu:/bluesanta/php-7.4.12$ ./configure --prefix=/bluesanta/apps/php-7.4.12 --with-apxs2=/bluesanta/apps/apache24/bin/apxs --enable-fpm --enable-inline-optimization --enable-shared --enable-soap --with-xmlrpc --with-openssl --with-mhash --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --enable-ftp --enable-gd --with-openssl-dir --with-zlib-dir --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-pdo --with-mysqli=/bluesanta/mysql-5.7.23/bin/mysql_config --with-pdo-mysql=/bluesanta/mysql-5.7.23/bin/mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-xsl --enable-mysqlnd-compression-support --with-pear --enable-opcache --with-mhash --with-curl --with-openssl --with-zlib --enable-intl
pi@Kubuntu:/bluesanta/php-7.4.12$ make -j4

php 모듈 테스트

pi@Kubuntu:/bluesanta/php-7.4.12$ make test
 
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Capture SSL session meta array in stream context [ext/openssl/tests/session_meta_capture.phpt]
Basic bitwise stream crypto context flag assignment [ext/openssl/tests/stream_crypto_flags_001.phpt]
TLSv1.1 and TLSv1.2 bitwise stream crypto flag assignment [ext/openssl/tests/stream_crypto_flags_002.phpt]
Server bitwise stream crypto flag assignment [ext/openssl/tests/stream_crypto_flags_003.phpt]
Specific protocol method specification [ext/openssl/tests/stream_crypto_flags_004.phpt]
PDO MySQL specific class constants [ext/pdo_mysql/tests/pdo_mysql_class_constants.phpt]
=====================================================================
 
=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
FPM: Buffered worker output decorated log with multiple continuous messages (stdout/stderr mixed) [sapi/fpm/tests/log-bwd-multiple-msgs-stdout-stderr.phpt] (warn: XFAIL section but test passes)
=====================================================================
 
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: n
make: *** [Makefile:232: test] 오류 1

php 설치

pi@Kubuntu:/bluesanta/php-7.4.12$ make install
Installing PHP SAPI module:       apache2handler
/bluesanta/apps/apache24/build/instdso.sh SH_LIBTOOL='/bluesanta/apps/apache24/build/libtool' libphp7.la /bluesanta/apps/apache24/modules
/bluesanta/apps/apache24/build/libtool --mode=install install libphp7.la /bluesanta/apps/apache24/modules/
libtool: install: install .libs/libphp7.so /bluesanta/apps/apache24/modules/libphp7.so
libtool: install: install .libs/libphp7.lai /bluesanta/apps/apache24/modules/libphp7.la
libtool: warning: remember to run 'libtool --finish /bluesanta/php-7.4.12/libs'
chmod 755 /bluesanta/apps/apache24/modules/libphp7.so
[activating module `php7' in /bluesanta/apps/apache24/conf/httpd.conf]
Installing shared extensions:     /bluesanta/apps/php-7.4.12/lib/php/extensions/no-debug-zts-20190902/
Installing PHP CLI binary:        /bluesanta/apps/php-7.4.12/bin/
Installing PHP CLI man page:      /bluesanta/apps/php-7.4.12/php/man/man1/
Installing PHP FPM binary:        /bluesanta/apps/php-7.4.12/sbin/
Installing PHP FPM defconfig:     /bluesanta/apps/php-7.4.12/etc/
Installing PHP FPM man page:      /bluesanta/apps/php-7.4.12/php/man/man8/
Installing PHP FPM status page:   /bluesanta/apps/php-7.4.12/php/php/fpm/
Installing phpdbg binary:         /bluesanta/apps/php-7.4.12/bin/
Installing phpdbg man page:       /bluesanta/apps/php-7.4.12/php/man/man1/
Installing PHP CGI binary:        /bluesanta/apps/php-7.4.12/bin/
Installing PHP CGI man page:      /bluesanta/apps/php-7.4.12/php/man/man1/
Installing build environment:     /bluesanta/apps/php-7.4.12/lib/php/build/
Installing header files:          /bluesanta/apps/php-7.4.12/include/php/
Installing helper programs:       /bluesanta/apps/php-7.4.12/bin/
  program: phpize
  program: php-config
Installing man pages:             /bluesanta/apps/php-7.4.12/php/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /bluesanta/apps/php-7.4.12/lib/php/
[PEAR] Archive_Tar    - installed: 1.4.9
[PEAR] Console_Getopt - installed: 1.4.3
[PEAR] Structures_Graph- installed: 1.1.1
[PEAR] XML_Util       - installed: 1.4.5
warning: pear/PEAR dependency package "pear/Archive_Tar" installed version 1.4.9 is not the recommended version 1.4.4
[PEAR] PEAR           - installed: 1.10.12
Wrote PEAR system config file at: /bluesanta/apps/php-7.4.12/etc/pear.conf
You may want to add: /bluesanta/apps/php-7.4.12/lib/php to your php.ini include_path
/bluesanta/php-7.4.12/build/shtool install -c ext/phar/phar.phar /bluesanta/apps/php-7.4.12/bin/phar.phar
ln -s -f phar.phar /bluesanta/apps/php-7.4.12/bin/phar
Installing PDO headers:           /bluesanta/apps/php-7.4.12/include/php/ext/pdo/

php.ini 복사

pi@Kubuntu:/bluesanta/php-7.4.12$ cp php.ini-production /bluesanta/apps/php-7.4.12/php.ini


/bluesanta/apps/apache24/conf\httpd.conf 내용 추가

# php
LoadModule php7_module        modules/libphp7.so
PHPIniDir "/bluesanta/apps/php-7.4.12"

... 생략 ...

    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    AddHandler application/x-httpd-php .php4 .php .phtml .ph .inc

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    #AddOutputFilter INCLUDES .shtml
    AddType application/x-httpd-php .php4 .php .phtml .ph .inc

</IfModule>

Apache 웹서버 재실행

$ sudo systemctl restart apache2