Question

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?

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top