SuiteCRM 7.12.x migration to SuiteCRM 8.x syntax error, unexpected 'class' (T_CLASS)

Hi, I am following the migration instruction to migrate from 7.1 to 8.x but when i run

./bin/console suitecrm:app:setup-legacy-migration

command i get following error:

PHP Parse error: syntax error, unexpected ‘class’ (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or ‘{’ or ‘$’ in /var/www/vhosts/rotografix.com/testcrm.rotografix.com/crm8/bin/console on line 17

PHP version is 7.4.33
run PHP as FPM by Apache

Can you shine some light please.
Thank you.

Those parse errors sometimes are simply typing errors accidentally put into a file when opening it in an editor…

Can you check what that line of that file contains?

Thank you for fast replay. This is he line in question, I don’t see any error?

#if (!class_exists(Application::class)) {
throw new LogicException(‘You need to add “symfony/framework-bundle” as a Composer dependency.’);
}

The error is that # character at the beginning of the line, it shouldn’t be there.

Before fixing it, you might want to notice the timestamp on the file, this will probably tell you when it was broken, in case you’re interested.

Here is the original unchanged file.

My mistake, that character was added by me by mistake. Sorry for confusion.
So I am getting the error when I run this command from suitecrm migration documentation:

`./bin/console suitecrm:app:upgrade -t SuiteCRM-8.2.0

and line 17 in console file is:

if (class_exists(Application::class)) {
throw new LogicException(‘You need to add “symfony/framework-bundle” as a Composer dependency.’);
}

Probably your CLI PHP is still an older version…

If you type

php -v

what do you get?

Hmm, this is the problem i think, wrong php version, but in php.ini info is 7.4

PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

It’s just that there are (at least) two PHP engines, one for web server and one for CLI (command-line), each with its own php.ini

On the command-line, type this to find your paths:

php -i | grep ini

There are many articles online explaining how to upgrade CLI PHP

Thank you! I was checking php but only with Plesk and Apache, didn’t check server version.
I am looking how to upgrade, Ill see how it goes.

Update.
I successfully updated PHP to version 8.2 on my CentOS 7 server.
You can find detailed instruction for Fedora, Red Hat, CentOS, and other clones on this page:

https://rpms.remirepo.net/wizard/

I can start migration now but I am getting new message:

In XmlUtils.php line 50:
Extension DOM is required.

I’ll probably start new tread if I can not solve this, and if anyone has some idea pleas help.

8.2? You jumped directly from too little to too much! :sweat_smile:

Stay inside the Matrix, Neo

Eh, I was like if I have to upgrade why not all the way. And as I understand 8.0 is already legacy one just for security, everyone suggesting 8.2 as stable version.
What now, to deinstall 8.2? Or to w8 for new updated version of SuiteCRM?

You can have multiple PHP versions in your system, and then select one (with a2enmod, if it’s Apache) for the web server to use. Just look online for instructions.

Not possible on Plesk+CentOS combination. I think I have to reinstall php on server.

About this issue you opened

Have you made sure all the required PHP modules are loaded in your 8.0?

That error seems like it’s simply missing the php-xml module.

In ubuntu I normally install all this:

apt install zip unzip iotop htop php-mbstring php7.3-mbstring php-gettext php7.3-xml php7.3-zip php7.3-imap php7.3-gd php7.3-curl php7.3-intl php7.3-mysql php-gd phpmyadmin

That’s for 7.3, of course, you’d need to find the equivalents for 8.0

Yes I have all the modules installed, problem is PHP 8.2 that I have now on server.
I read the roadmap, plan is to switch SuiteCRM completely to new PHP 8.2 sometimes in March.
I’ll probably need to deinstall php and instal up to version 8.0 or wait till march.

Thank you for help.

1 Like