0

when I use php bin/magento indexer:reindex or php bin/magento cron:run I keep getting this error.

Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/[NAME]/public_html/vendor/magento/framework/Filesystem/Directory/Write.php on line 35

I'm using php 7.2 and Magento 2.3

Any ideas of how to fix this?

2 Answers 2

1

Make a dummy php file and put in it. Look for the PHP version and make sure 7.2 is really there. Because this kind of error might occur with incompatible PHP version.

1
  • Thanks for the answer. I thought that too but couldn't find the problem there. it was 7.2 in the phpinfo.php file. However I found a solution for the issue which I posted under the question if you want to check it out. Thanks again.
    – Ardavan
    Dec 31, 2018 at 23:12
0

Ok so I doubled check and my PHP was 7.2 no problem with that. Now the way I was able to fix it was to run this code:

[-/public_html]#/usr/local/php72/bin/php-cli bin/magento indexer:reindex

instead of:

php bin/magento indexer:reindex

to directly execute the command via the php-cli binary. Same for the other commands such as:

bin/magento setup:update

seems to be working fine right now. But I don't know the reason I was getting that error.

Your Answer

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

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