数天前,为了修复一个重要的安全漏洞,于是将服务器上的三件套都升级到了最新版本 —— nginx php mysql。
升级完成之后按照惯例排查时发现,nextcloud不支持php. 7.4及以上版本?!
本以为又要重新安装一次了,修改文件的时候突然发现,在nextcloud根目录的lib目录里面有一个versioncheck.php文件,检查版本逻辑竟然是由它决定的。
遂打开,发现其中默认内容是这样的。
<?php
// Show warning if a PHP version below 7.1 is used,
if (version_compare(PHP_VERSION, '7.1') === -1) {
http_response_code(500);
echo 'This version of Nextcloud requires at least PHP 7.1<br/>';
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
exit(-1);
}
// Show warning if > PHP 7.3 is used as Nextcloud is not compatible with > PHP 7.3 for now
if (version_compare(PHP_VERSION, '7.3.0') !== -1) {
http_response_code(500);
echo 'This version of Nextcloud is not compatible with > PHP 7.3.<br/>';
echo 'You are currently running ' . PHP_VERSION . '.';
exit(-1);
}
于是把版本号改高,nextcloud就可以正常打开了。
<?php
// Show warning if a PHP version below 7.1 is used,
if (version_compare(PHP_VERSION, '7.1') === -1) {
http_response_code(500);
echo 'This version of Nextcloud requires at least PHP 7.1<br/>';
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.';
exit(-1);
}
// Show warning if > PHP 7.5 is used as Nextcloud is not compatible with > PHP 7.3 for now
if (version_compare(PHP_VERSION, '7.5.0') !== -1) {
http_response_code(500);
echo 'This version of Nextcloud is not compatible with > PHP 7.3.<br/>';
echo 'You are currently running ' . PHP_VERSION . '.';
exit(-1);
}
由于nextcloud16.0是基于php7.2设计的,在强行解除限制,在php7.4环境下使用后并没有发现什么问题。各项功能均正常。