Centos

如何在 CentOS 8 上安裝 PHP 7.4.3?

  • January 20, 2021

我需要升級到 PHP 7.4.3(從7.4.14),並且在很多很多小時後我不知何故沒有取得任何進展。* MediaWikiRoundcubePostfixAdmin需要。

兩個問題:

  1. 是否必須從原始碼編譯才能獲得7.4.3,還是有更簡單的方法?
  2. 如果以上是肯定的,我該如何修復下面的錯誤?

錯誤

openssl並且imap顯然給我帶來了麻煩(opcache在我禁用它之前更糟)

=====================================================================
TIME END 2021-01-19 04:58:21

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   18
Exts tested     :   55
---------------------------------------------------------------------

Number of tests : 15674             12815
Tests skipped   : 2859 ( 18.2%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   17 (  0.1%) (  0.1%)
Expected fail   :   35 (  0.2%) (  0.3%)
Tests passed    : 12763 ( 81.4%) ( 99.6%)
---------------------------------------------------------------------
Time taken      : 1099 seconds
=====================================================================

=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
Test open_basedir configuration [tests/security/open_basedir_linkinfo.phpt]  XFAIL REASON: BUG: open_basedir cannot delete symlink to prohibited file. See also
bugs 48111 and 52176.
Inconsistencies when accessing protected members [Zend/tests/access_modifiers_008.phpt]  XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Inconsistencies when accessing protected members - 2 [Zend/tests/access_modifiers_009.phpt]  XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770.phpt]  XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_2.phpt]  XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_3.phpt]  XFAIL REASON: See Bug #48770
Initial value of static var in method depends on the include time of the class definition [Zend/tests/method_static_var.phpt]  XFAIL REASON: Maybe not a bug
DateTime::add() -- fall type2 type3 [ext/date/tests/DateTime_add-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- fall type3 type2 [ext/date/tests/DateTime_add-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- fall type3 type3 [ext/date/tests/DateTime_add-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type2 type3 [ext/date/tests/DateTime_add-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type3 type2 [ext/date/tests/DateTime_add-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::add() -- spring type3 type3 [ext/date/tests/DateTime_add-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type2 type3 [ext/date/tests/DateTime_diff-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type3 type2 [ext/date/tests/DateTime_diff-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- fall type3 type3 [ext/date/tests/DateTime_diff-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type2 type3 [ext/date/tests/DateTime_diff-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type3 type2 [ext/date/tests/DateTime_diff-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::diff() -- spring type3 type3 [ext/date/tests/DateTime_diff-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type2 type3 [ext/date/tests/DateTime_sub-fall-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type3 type2 [ext/date/tests/DateTime_sub-fall-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- fall type3 type3 [ext/date/tests/DateTime_sub-fall-type3-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type2 type3 [ext/date/tests/DateTime_sub-spring-type2-type3.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type3 type2 [ext/date/tests/DateTime_sub-spring-type3-type2.phpt]  XFAIL REASON: Various bugs exist
DateTime::sub() -- spring type3 type3 [ext/date/tests/DateTime_sub-spring-type3-type3.phpt]  XFAIL REASON: Various bugs exist
Bug #52480 (Incorrect difference using DateInterval) [ext/date/tests/bug52480.phpt]  XFAIL REASON: See https://bugs.php.net/bug.php?id=52480
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, bd2) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-bd2.phpt]  XFAIL REASON: Still not quite right
RFC: DateTime and Daylight Saving Time Transitions (zone type 3, fs) [ext/date/tests/rfc-datetime_and_daylight_saving_time-type3-fs.phpt]  XFAIL REASON: Still not quite right
Bug #42718 (unsafe_raw filter not applied when configured as default filter) [ext/filter/tests/bug42718.phpt]  XFAIL REASON: FILTER_UNSAFE_RAW not applied when configured as default filter, even with flags
Bug #67296 (filter_input doesn't validate variables) [ext/filter/tests/bug49184.phpt]  XFAIL REASON: See Bug #49184
Bug #67167: filter_var(null,FILTER_VALIDATE_BOOLEAN,FILTER_NULL_ON_FAILURE) returns null [ext/filter/tests/bug67167.02.phpt]  XFAIL REASON: Requires php_zval_filter to not use convert_to_string for all filters.
via [ext/pdo_sqlite/tests/common.phpt]
       SQLite PDO Common: PDOStatement::getColumnMeta [ext/pdo_sqlite/tests/pdo_022.phpt]  XFAIL REASON: This feature is not yet finalized, no test makes sense
Phar: bug #69958: Segfault in Phar::convertToData on invalid file [ext/phar/tests/bug69958.phpt]  XFAIL REASON: Still has memory leaks, see https://bugs.php.net/bug.php?id=70005
updateTimestamp never called when session data is empty [ext/session/tests/bug71162.phpt]  XFAIL REASON: Current session module is designed to write empty session always. In addition, current session module only supports SessionHandlerInterface only from PHP 7.0.
Bug #73529 session_decode() silently fails on wrong input [ext/session/tests/bug73529.phpt]  XFAIL REASON: session_decode() does not return proper status.
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #77020 (null pointer dereference in imap_mail) [ext/imap/tests/bug77020.phpt]
Bug #65729: CN_match gives false positive when wildcard is used [ext/openssl/tests/bug65729.phpt]
Bug #68265: SAN match fails with trailing DNS dot [ext/openssl/tests/bug68265.phpt]
Bug #68879: Match IP address fields in subjectAltName checks [ext/openssl/tests/bug68879.phpt]
Bug #68920: peer_fingerprint input checks should be strict [ext/openssl/tests/bug68920.phpt]
Bug #69215: Crypto servers should send client CA list [ext/openssl/tests/bug69215.phpt]
Peer verification matches SAN names [ext/openssl/tests/san_peer_matching.phpt]
security_level setting to prohibit cert [ext/openssl/tests/stream_security_level.phpt]
Specific crypto method for ssl:// transports. [ext/openssl/tests/streams_crypto_method.phpt]
tls stream wrapper with min version 1.0 and max version 1.1 [ext/openssl/tests/tls_min_v1.0_max_v1.1_wrapper.phpt]
tls stream wrapper [ext/openssl/tests/tls_wrapper.phpt]
tls stream wrapper when TLS 1.3 available [ext/openssl/tests/tls_wrapper_with_tls_v1.3.phpt]
tlsv1.0 stream wrapper [ext/openssl/tests/tlsv1.0_wrapper.phpt]
tlsv1.1 stream wrapper [ext/openssl/tests/tlsv1.1_wrapper.phpt]
tlsv1.2 stream wrapper [ext/openssl/tests/tlsv1.2_wrapper.phpt]
tlsv1.3 stream wrapper [ext/openssl/tests/tlsv1.3_wrapper.phpt]
Multicast support: IPv6 receive options [ext/sockets/tests/mcast_ipv6_recv.phpt]
=====================================================================

嘗試

基本總結;不包括在修改系統的嘗試失敗後無數的兔子洞、彎路和恢復。

  1. 試過dnfremi.
Could not specify **7.4.3**, just **7.4.14**.  Have PHP 72, 73 74, and 80, with 7.4.14 currently enabled.
  1. 編譯 + 安裝 PHP 8.0
Mistake (did not know that '>= **7.4.3**' instructions evidently does not include >= 8.0)

Note: naturally, because none of the programs could run on this version, it of course compiled/installed seamlessly, with not even one error (:
  1. 新解決方案:從原始碼編譯7.4.3

一世。從官方 PHP 站點獲得 php 7.4.3 ; .tar提取它並做了./configure ...

ii. 執行./configure ...,第一個錯誤:

Wrong version for PHP extensions

Solution: almost all of the non-base PHP extensions needed their `-devel` version installed.

iii. ./configure ...現在工作,所以執行make cleanmake && make test

make test錯誤:類似於下面的錯誤(在“錯誤”下),但至少是兩倍,因為opcache

Solution: Added `--disable-opcache --disable-opcache-file` to `./configure ...`

iv. 再次執行make clean_ make && make test_sudo

Where I am now.  Already have openssl-devel, and cannot find imap-devel or anything similar.

make程序

要正常執行./configure,必須安裝以下所有內容yumoniguruma, oniguruma-develDNF 除外):

libcurl-devel, bzip2-devel, libpng-devel, libjpeg-devel, freetype-devel, libc-client-devel, libicu-devel, oniguruma, oniguruma-devel, postgresqlm, postgresql-devel, readline-devel, libsodium-devel, libxslt-devel, zip-devel, libsodium-devel, libxslt-devel, zip-devel

第一次成功:

% Used --disable-opcache --disable-opcache-file to get rid of opcache errors, since it is optional
sudo ./configure --prefix=/opt/php-7.4 --with-pdo-pgsql --with-zlib-dir --enable-ctype --with-freetype --enable-mbstring --enable-soap --enable-calendar --with-curl --with-zlib --enable-gd --with-pgsql --disable-rpath --enable-inline-optimization --with-bz2 --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --with-zip --with-pdo-mysql --with-mysqli --with-mysql-sock=/var/lib/mysql/mysql.sock --with-jpeg --with-openssl --with-fpm-user=nginx --with-fpm-group=nginx --with-libdir=lib64 --enable-ftp --with-imap --with-imap-ssl --with-kerberos --with-gettext --with-xmlrpc --with-xsl --disable-opcache --enable-intl --with-pear --enable-shmop --with-sodium --with-readline --enable-fpm

系統詳情

VPS,CentOS 8。用作 web 和電子郵件伺服器,node.js 用於除上述 3 個 PHP 程序之外的所有內容。

數據庫: mariadb

郵件: postfix、dovecot、opendkim、opendmarc、spamassassin、clamav

網站: nginx

其他: : php-fpm、MEAN 堆棧、一些 LEMP(MediaWiki、Roundcube 和 PostfixAdmin)

我需要升級到 PHP 7.4.3(從 7.4.14)

你明白這不是升級,而是降級,因為 7.4.3 比 7.4.14 舊?

使用您的連結。

來自 MediaWiki

請改用 PHP 7.4.3 或更高版本。

來自 Roundcubemail

PHP 5.4.1 或更高版本(以及 < 8.0 **)

來自 PostFixAdmin

支持PHP7.0+

所以7.4.14很好,我不明白你為什麼認為你需要 7.4.3,它有很多安全問題(在最近的版本中修復)

事實上,我的儲存庫只有最後兩個線上次要版本(所以現在是 7.4.13 和 7.4.14),但是你可以在論壇上“真正”需要時請求更舊的版本

引用自:https://serverfault.com/questions/1050508