Jump to content

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


Recommended Posts

Posted

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
Posted (edited)

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
Posted

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.

Posted

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
Posted

Okay thanks! Let me try this.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...