cancel
Showing results for 
Search instead for 
Did you mean: 

when execute via ssh bin/magento setup:upgrade I get sintax error

SOLVED

when execute via ssh bin/magento setup:upgrade I get sintax error

Hi, 

I get: 

PHP Parse error:  syntax error, unexpected '[', expecting ')' in /var/www/vhosts/mydomain/bin/magento on line 22

 

via ssh when type bin/magento setup:upgrade.

 

I'm using magento 2 with data migrate from magento 1.9 via magento migrate tool

 

thx for the answer.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

A server can use different PHP versions for the command line and for webserver.

Please ensure you have the proper PHP versions for the command line.

You can do it by executing the php -v command from the Magento 2 root folder.

View solution in original post

9 REPLIES 9

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

Your PHP version is lower than Magento 2 requires.

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

I have checked via phpinfo() the version and it is 7.0.4.

The DB version is correct because I had installed, previusly, magento 2 on this server.

 

The issue still persist

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

A server can use different PHP versions for the command line and for webserver.

Please ensure you have the proper PHP versions for the command line.

You can do it by executing the php -v command from the Magento 2 root folder.

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

I have executing the php -v and i get back:

PHP 5.3.3 (cli) (built: Feb  9 2016 10:36:17)

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

    with the ionCube PHP Loader v4.6.0, Copyright (c) 2002-2014, by ionCube Ltd.

 

 

soon as possible I will set the php version.

 

I let you know if this fix the issue. Thanks for quick answer.

 

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

Hello again.

the bin/magento setup:upgrade works fine now.
It give me the follow message:

Please re-run Magento compile command

then I run  bin/magento setup:di:compile

and get:

Compilation was started.

Interception cache generation... 7/7 [============================] 100% 2 mins 224.0 MiBBB MiB

Generated code and dependency injection configuration successfully.

But I get blank page on website and admin area. 

 

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

How to diagnose Magento 2 errors: https://mage2.pro/t/307

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

Thanks Dmity_Fedyuk,


it was a user permission gropu issues.

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

I ma having this problem with the hosting place, I did not know that CLI can use different versions of PHP, when I issue php -v from the root directory I get 5.3 version.

 

I have asked the hosting company and they said that PHP Alias defaults to 5.3, and have given me paths to use various CLIs, if I am understanding it correctly

 

/usr/local/php54/bin/php-cli
/usr/local/php55/bin/php-cli
/usr/local/php56/bin/php-cli
/usr/local/php70/bin/php-cli

 

If I want to issue a command such as reindex or static-content:deploy, do I issue the following form the root?

public_html]# php /usr/local/php56/bin magento static-content:deploy

 

Re: when execute via ssh bin/magento setup:upgrade I get sintax error

Sorry it was my fault, NO PHP at the beginning

 

public_html]# /usr/local/php56/php-cli  bin/magento setup:static-content:deploy