Can't use echo function in PHP on Ubuntu

January 28, 2018 1.2k views
PHP Ubuntu 16.04

Just create my first droplet to Digital Ocean.

I have a Ubuntu 16.04.3 x64.

This is working:

<?= phpinfo(); ?>

This is not working:

<? echo phpinfo(); ?>

It just show in the inspect element tools: <? echo phpinfo(); ?>.

Do I missed something ?


1 Answer

It is possible that the default configuration disables <? but allows <?= and <?php

This can be changed by editing your php.ini file (in /etc/php5 or /etc/php7.0) so that it includes:

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!