im trying to setup my php server to use
<?
echo 'ok';
?>
syntaxis without 'php' inside opening tag. Now my code works like this
<?php
echo 'ok';
?>
How can i achieve this? I tried to install latest version of php, but it still not working.
im trying to setup my php server to use
<?
echo 'ok';
?>
syntaxis without 'php' inside opening tag. Now my code works like this
<?php
echo 'ok';
?>
How can i achieve this? I tried to install latest version of php, but it still not working.
ANSWER:
Set short_open_tag=On
in your php.ini and restart the server.
CAVEAT:
Short open tags are not used according to PHP coding standard PSR-1 which states:
PHP code MUST use the long
<?php ?>
tags or the short-echo<?= ?>
tags; it MUST NOT use the other tag variations.
The reason for this as mentioned by @Magnus Eriksson is that there may be situations where you do not have access to edit the php.ini and therefore code that uses short tags will be rendered unusable in those environments. Adhere to the standard for maximum portability!
You need to edit your php.ini file and turn short_open_tags on
short_open_tag = On