Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Tommy001's avatar

Unexpected '?' in helpers.php on line 500

I have built a Laravel 5.7 site locally and I am now trying to deploy it to a remote shared webserver. I am half way there, but no images are showing though they exist in the right folders and also when I try to run "php artisan config:cache" I get the above error message about a missing '?' in "/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php on line 500".

All the answers I have seen after googling the solution has been that I need PHP7. But the thing is that I do have that. Locally where everyting works I have PHP 7.2.3. and on the remote server I have PHP 7.2.10 (there are 2 more versions to choose from, but the problem is the same for each of these.

What do I do? Maybe I should mention that I haven't got access to composer on the remote server, so I have transferred all vendor files manually with Filezilla.

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

Sounds like the command line is using the wrong php version.

You need to ask your host how to use the right version on the command line.

Verify this with php -v

1 like
Tommy001's avatar

Thanks Snapey... that was indeed the problem. php -v givs me PHP 5.6.33 in my cygwin CLI. I will have to post them a question and probably wait until monday for this to be fixed :-/

EDITED: in case any one else has the same problem. It's possible to define routes to clear caches outside of the CLI. Just remember to comment out those line afterwards. Look here: https://stackoverflow.com/questions/31455829/laravel-5-clear-cache-in-shared-hosting-server

Please or to participate in this conversation.