1

Can't seem to find a fix for this issue. I'm running Magento 2.1.2 with PHP 7.0.16, however there are different versions of PHP installed on different websites on the same VPS.

When trying to execute magento/bin commands, it seems to throw the same error with any - however the most recent I've tried is:

 php bin/magento setup:static-content:deploy

It throws the following errors:

PHP Warning: Cannot open '/usr/lib64/php/modules/php_browscap.ini' for reading in Unknown on line 0
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in ***/httpdocs/vendor/magento/framework/App/Bootstrap.php on line 411

The function which includes line 411 is as follows, with the problem line surrounded by **:

public function isDeveloperMode()
{
 $mode = 'default';
 if (isset($this->server[State::PARAM_MODE])) {
 $mode = $this->server[State::PARAM_MODE];
 } else {
 ** $deploymentConfig = $this->getObjectManager()->get(DeploymentConfig::class); **
 $configMode = $deploymentConfig->get(State::PARAM_MODE);
 if ($configMode) {
 $mode = $configMode;
 }
 }
 return $mode == State::MODE_DEVELOPER;
}

The only details I can find online relate to there being an incompatible installation of PHP, but that shouldn't be an issue as I'm running 7.0.16?

asked Mar 15, 2017 at 11:16
2
  • 1
    what's in Bootstrap.php on line 411? In the latest version on github there is this github.com/magento/magento2/blob/develop/lib/internal/Magento/… which does not make much sense. Commented Mar 15, 2017 at 11:21
  • @Marius I'll edit the question so I can include the entire function Commented Mar 15, 2017 at 13:29

2 Answers 2

2

Turned out to be an issue with multiple versions of PHP being installed on the same VPS and running Plesk. Setting up an independent VPS only running PHP 7.0.16 fixed the errors.

answered Mar 21, 2017 at 13:58
1

Just in case someone else comes across this, it was solved by changing the default version of php to the latest one in plesk

For example, my system php is 5.5:
$ php -v
PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:23:08)
$ which php
/usr/bin/php
But I want to use php 5.6 installed by Plesk:
$ /opt/plesk/php/5.6/bin/php -v
PHP 5.6.13 (cli) (built: Sep 8 2015 11:53:39)
$ export PATH=/opt/plesk/php/5.6/bin:$PATH
$ php -v
PHP 5.6.13 (cli) (built: Sep 8 2015 11:53:39)
$ which php
/opt/plesk/php/5.6/bin/php
answered Jan 25, 2019 at 11:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.