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?

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

  • 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? – Marcel Jan 2 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 – Raul Sanchez Jan 2 at 14:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.