1

i am trying to install laravel environment on centos 7 with php 7.4.29 and when i apply the command "composer install --ignore-platform-reqs", i got the error below,

Parse error: syntax error, unexpected 'static' (T_STATIC) in /var/www/laravel/vendor/symfony/string/UnicodeString.php on line 44

Appreciate your help!

1 Answers1

2

Appears you are using symfony 6.1 https://github.com/symfony/string/blob/6.1/UnicodeString.php which is for PHP 8.1.

Using --ignore-platform-reqs has allowed it to be installed as normally it would be version constraint of PHP >=8.1

Code with static return type will not be backwards-compatible with older PHP versions prior to 8.0. Doing so will result in a parse error:

Parse error: syntax error, unexpected 'static' (T_STATIC) in ... on line ...

It is not possible to back-port this feature to older PHP versions either.

  • Thank you! I installed laravel 8 which support php 7.4, i get the error, Problem 1 - laravel/framework[v8.75.0, ..., 8.x-dev] require league/flysystem ^1.1 -> satisfiable by league/flysystem[1.1.0, ..., 1.x-dev]. - league/flysystem[1.1.0, ..., 1.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension. - Root composer.json requires laravel/framework ^8.75 -> satisfiable by laravel/framework[v8.75.0, ..., 8.x-dev]. – Bassel Mahfoud Jun 01 '22 at 10:51