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

Isavic's avatar

[07-Jul-2020 05:03:01 America/Chicago] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home2/coinmac/interlink.coinmac.org/index.php on line 52

[07-Jul-2020 05:03:01 America/Chicago] PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home2/coinmac/interlink.coinmac.org/index.php on line 52

The above error came up when i hosted my new web application using (laravel 7.14.1) via share hosting on hostgator. I contacted their customer service to update the php version but when i tried to load the site, it brings out error that the page is not working. I checked the error log and found the above error message. please i need help. Thanks

0 likes
5 replies
tykus's avatar
tykus
Best Answer
Level 104

I would guess that your PHP version is incompatible with the ::class constant; which means it might be PHP <5.5.

I would check to what version your host can upgrade the PHP version; or, find a better host.

If you can, very temporarily throw a phpinfo() into the top of that public/index.php file to see what version the web server is actually running

Isavic's avatar

After updating my php version 7.3, i got another error:

file_put_contents(C:\xampp\htdocs\laravel\interlinkltd\storage\framework/sessions/Xxtj79G3ucc1l3QvTs43lkUFydQvuWf1RnhmoY1L): failed to open stream: No such file or directory

Please how do i fix this?

Isavic's avatar

I have fixed the error above. What i did:

  1. i Navigate to my projects /bootstrap/cache/ folder.

  2. Delete the contents of the directory and it was solved

I am currently faced with this challenge: the home page is loading normally and the home link on my navbar is working but all other links are not working. what could be the problem

tykus's avatar

You possibly have an issue with rewriting URLs? Which web server are you using; Apache, Nginx, other?

Isavic's avatar

Apache... Thanks tykus. I have been able to fix the issue. I initially copied the content of my web application folder before archiving it and then uploading it to my host. I think the issue was, there is this hidden folder (.git) i didn't copy along with others files before archiving and all. So, i had to make sure that the .git folder is archived along with other files before uploading to my host (hostgator) and that was it.

Please or to participate in this conversation.