How to Enable Short Open Tag (short_open_tag) in PHP
Abstract: > tags to write php code. Enable Short Tag in PHP To enable short_open_tag edit PHP configuration file> tags. Generally php users used
short_open_tag directive determines whether or not PHP will recognize code written between <? — ?> tags. Generally php users used <?php — ?> tags to write php code.
Enable Short Tag in PHPTo enable short_open_tag edit PHP configuration file 「php.ini」 and set following value to On. Default this value is set to Off.
short_open_tag = On
After making above changes restart Apache service.
Verify Short Tag in EnabledTo verify that short tag is enabled in your PHP configuration. Create a file check.php with following content.
[php]
Now execute this script using the command line or access file in a web browser.
php check.php
Result if PHP Short Tag is On:
PHP short open tag test
Result if PHP short tag is Off: This will display PHP code on screen.
<? echo "PHP short open tag test"; ?>