Skip to content

Commit 8eb6183

Browse files
[CMS-449] Error message and halt on PHP <5.5 or >=8.0 (#2269)
1 parent da604d6 commit 8eb6183

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

bin/terminus

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99
* - Exits with a status code
1010
*/
1111

12+
// Version compatibility check and messaging
13+
if (version_compare(PHP_VERSION, '5.5.0', '<') === true) {
14+
echo "\n";
15+
echo 'Sorry, your PHP version (' . PHP_VERSION . ') is no longer supported.' . "\n";
16+
echo 'Upgrade to PHP 5.5 or newer to use Terminus'; echo "\n\n";
17+
exit(1);
18+
} elseif (version_compare(PHP_VERSION, '8.0', '>=') === true) {
19+
echo "\n";
20+
echo 'PHP 8.0+ is not supported by this version of Terminus.' . "\n";
21+
echo 'Upgrade to Terminus 3 for PHP 8+ support.' . "\n";
22+
echo "\n";
23+
exit(1);
24+
}
25+
1226
$pharPath = \Phar::running(true);
1327
if ($pharPath) {
1428
include_once("$pharPath/vendor/autoload.php");

0 commit comments

Comments
 (0)