0

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/c1305873c/ntn/vendor/ramsey/uuid/src/functions.php on line 34

I try to put online my first project with laravel but i have this error, using PHP version 7

Syscall
  • 19,327
  • 10
  • 37
  • 52
  • 1
    Hello Arsene. Welcome to Stackoverflow. This is Syntax error which means you have written something wrong in functions.php on line 34. Either share your code or use your IDE's tool to inspect your code. – Shafiq al-Shaar Jun 06 '20 at 11:46
  • 1
    It might be null coalescing (??) operator make sure your server is serving PHP 7. Not only on CLI but also on the webserver (apache2 or other). – Anuj Shrestha Jun 06 '20 at 13:06
  • hey @Arsene, welcome to Stackoverflow, it would be nice if you can share more info such as what is the server OS (windows, linux, ...) and distribution (if linux is it debian or redhat, ...), also where exactly do you have this error (after composer install? or after migration), list the steps you used to deploy the project on the server – George Jun 06 '20 at 13:30
  • Does this answer your question? [What is the purpose of the question marks before type declaration in PHP7 (?string or ?int)?](https://stackoverflow.com/questions/48450739/what-is-the-purpose-of-the-question-marks-before-type-declaration-in-php7-stri) – Syscall Dec 28 '22 at 17:27

1 Answers1

0

This problem is typically associated with an inconsistency in PHP versions.

More than likely, you are running PHP >=7.1 on your dev machine but the server that you have pushed to is running <=7.0.

If you're running Laravel 7 then you're going to need a minimum of PHP 7.2.5 on the server anyway so your options are either to upgrade the server or drop down to Laravel 6.

Joseph
  • 2,737
  • 1
  • 30
  • 56