0

I just setup php 7.0.27 in both webserver and cli. My laravel project was working just fine before in php 7.2. When I try run command php artisan serve it shows an error:

PHP Parse error:  syntax error, unexpected '?', expecting variable 
(T_VARIABLE) in /var/www/html/pmanager/pmanager/vendor/symfony/console
/Output/Output.php on line 40

I followed this github discussion which says that the solution is installing same versions in cli and webserver, which, in my case is fine. I have 7.0.27 in both.

Another thing they are pointing it out is laravel shows this error with php 7.0. I cannot change my php version to 7.1 or 7.2 because I must stick with it so as to run magento 2.1 projects.

Any help without changing php version would be highly appreciated.

8
  • Have you removed the vendor dir and re installed dependencies? The latest symfony console requires PHP >= 7.1.3 so dependencies might not be compatible anymore Commented Mar 6, 2018 at 6:01
  • @JimL I did nothing to my laravel project. Commented Mar 6, 2018 at 6:11
  • That might be the problem, you have installed the dependencies on PHP 7.2 so you are probably using dependencies that are not compatible with PHP < 7.2 Commented Mar 6, 2018 at 8:58
  • Is there any way I could fix this without starting again with empty project? Commented Mar 6, 2018 at 9:38
  • Yes, delete the vendor dir and reinstall the dependencies. Commented Mar 6, 2018 at 9:39

1 Answer 1

1

you can downgrade your laravel 5.6 project to 5.5!!

  • Changing the value of the Laravel version inside the composer.json file to the laravel 5.5.
  • Delete /vendor folder and run composer install
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.