Jump to content

Fatal error: Cannot use 'Object' as class name as it is reserved in PHP 7.1


sagnik

Recommended Posts

Why the following error has occurred in PHP 7.1? As far as I know, the 'Object' is used as a reserved keyword from PHP 7.2. I'm using PHP 7.1.1 in my local server and it works fine without any errors then why not in Heliohost? And I've switched from PHP 7.3 to PHP 7.1 using MultiPHP Manager in cPanel.

Fatal error: Cannot use 'Object' as class name as it is reserved in /home/sgn/public_html/careers4you/config/classes/Careers4You/Helpers/Object.php on line 31
Link to comment
Share on other sites

It sounds like your domain is not actually changing php versions. I'll take a look when I'm at a computer.

Nonetheless, it's still a bad idea to use object in this manner anyway, since in the future you may need to run this on newer php. The best fix is to not use the word object this way.

Edited by wolstech
stupid autocorrect
  • Like 1
Link to comment
Share on other sites

Okay, I'll change the name but to change the name I've to change lot of things. For now I just need to check if everything is working fine.

Link to comment
Share on other sites

I'm assuming the file that's erroring is being included by something located in /home/sgn/public_html/careers4you/public_html ? If so, try adding this to the .htaccess in that folder:

 


<IfModule mime_module>
  AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>

Also, keep in mind that the PHP version used is based on the configuration for the script the user visits in their browser (i.e. you can't use a different version just for the includes). Includes can't have their own separate version of PHP, but rather an included file always inherits the PHP version of its includer. 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...