I am trying to install magento 2.3.0 on localhost i am getting following issue.

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


Magento 2.3 is not supporting php version 7.0

it works with php 7.1 OR php 7.2. It fully supports php 7.2.

Please check your php version and upgrade it to php 7.2(recommended).


Check this official link https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html

Check whether your system satisfies it's requirement as php 7.0 and php extensions.

In future mention which machine you are trying to deploy magento in your question description.


As mentioned in requirement doc https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html

Magento v2.3.0 supports PHP v7.1.3+ so any version higher than this will resolve your issue.

I tested it with PHP v7.1.24 it works fine.


You can just use 'php72' instead the 'php' and there would be no issues.



Please check this link After installing magento 2.3 admin login page cant open properly

Find : /vendor/magento/framework/View/Element/Template/File/Validator.php:139

find : 
foreach ($directories as $directory) {
    if (0 === strpos($realPath, $directory)) {
        return true;

Replace with:
foreach ($directories as $directory) {
    $realDirectory = $this->fileDriver->getRealPath($directory);
    // and replace `$directory` with `$realDirectory`
    if (0 === strpos($realPath, $realDirectory)) {
        return true;
  • No it does not work. – zuber bandi Feb 12 '19 at 6:32

Seems your magento version does not support your PHP version.

If you want to run it as 7.2 on ssh you should append the path to php 7.2 first and then php- command.

Open .htacess and add this line on the top of it SetEnv PHPRC /home/your directory/public_html/php.ini

So the system could know now php.ini path.

Now open CMD and execute any command with this /usr/local/bin/phpxx bin/magento c:c where XX should be your desired php version, for instance php72 or php71 etc

/usr/local/bin/phpxx bin/magento c:c this command clears the cache

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.