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

MaxStyles's avatar

Laravel 5.5 PHP Error

Hello, I have this error "Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE)" in the folder /vendor/symfony/translation/Translator.php.

Supposedly the error is due to the PHP version. But my hosting can not have a php version greater than 7.0, what can I do?

Thanks in advance.

0 likes
3 replies
tokoiwesley's avatar

It seems like you app is hosted on server with a shared hosting plan. The solution is to get a VPS (from hosting solutions like Digitalocean, Linode, Vultr etc.) which allows for such flexibility - like installing a specific version of PHP.

STEREOH's avatar

Keep in mind that laravel isn't compatible anymore with PHP 7.0 since Laravel 5.5 (last compatible version)

So either downgrade your laravel version to 5.5, or find an other hosting plan (recommended).

Edit: Didn't see you were already running on 5.5.

The problem here is you installed laravel through composer on a machine with PHP7.1+ so the installer took some liberties adding PHP7.1+ code. The only way for you to get it to work on your shared hosting would be to downgrade your PHP to 7.0 on your dev machine and install laravel again. Before sending it all back to your shared host.

Source : https://github.com/laravel/framework/issues/23559#issuecomment-373571205

Please or to participate in this conversation.