Php7 does not work with short-tags

Solution 1:

The problem is that, by default, PHP 7 does not supports short open tags <?.

It is described in the article PHP tags from php.net.

You need to use the full open tag <?php. Or, if you have PHP programs which are written for previous versions of PHP, you can change this rule in these ways:

  • you can add next directive into your-apache2-virtualhost.conf (or .htaccess) file:

    php_flag short_open_tag on
    
  • into the file /etc/php/7.x/apache2/php.ini you can set:

    short_open_tag = on
    

Don't forget to restart Apache2:

sudo systemctl restart apache2.service