2

I want to Install cron with putty SSH. I use php bin/magento cron:install [--force] and get this error:

PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /www/htdocs/xxx/xxx/xxx/vendor/magento/framework/Filesystem/Directory/Write.php on line 35

Server run with PHP Version 7.2.11-nmm1. What can I do? Where I can begin to search for it?

Chirag Patel
6,1662 gold badges26 silver badges66 bronze badges
asked Jan 2, 2019 at 14:00

1 Answer 1

1

It seems your php version does not parse correctly Nullable types (such as that ?PathValidatorInterface), which were introduced in php7.1 http://php.net/manual/en/migration71.new-features.php

public function __construct(
 \Magento\Framework\Filesystem\File\WriteFactory $fileFactory,
 \Magento\Framework\Filesystem\DriverInterface $driver,
 $path,
 $createPermissions = null,
 ?PathValidatorInterface $pathValidator = null
) {
 parent::__construct($fileFactory, $driver, $path, $pathValidator);
 if (null !== $createPermissions) {
 $this->permissions = $createPermissions;
 }
}

Double check your php version in command line, as it does not seem to be 7.2

It is not rare to have more than 1 php version installed, for instance https://stackoverflow.com/a/50591861/1073040

answered Jan 2, 2019 at 14:15
2
  • Yes I checked: PHPinfo.php detect: the 7.2 Version and if I check with: "php -version in SSH i get the info : 7.0.32. Where I can change the version to 7.2? Commented Jan 2, 2019 at 14:30
  • You'd uninstall or disable 7.0... the way to do that would depend by the operative system you use. If you are in a Unix server & using Apache as webserver I have referenced an example for it Commented Jan 2, 2019 at 14:36

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.