Short open tags are a type of PHP code that allows you to use abbreviated syntax. This means you can omit the full <?php tag and instead use <?. This can save you a lot of time and effort, especially if you’re writing long PHP code blocks. Short open tags are not enabled by default in PHP, but you can easily enable them by adding a line of code to your php.ini file. Just open the file in a text editor and add the following line: “short_open_tag = On”. Once you’ve saved the file, restart your web server and you’ll be able to use short open tags in your PHP code.
Enable Short Tags in PHP
Enabling short open tags is easy to do in most cases. First, open your php.ini file in a text editor. Then, look for the line that says “short_open_tag = Off” and change it to “short_open_tag = On”. Save the file and restart your web server, and you should be good to go!
short_open_tag = On
After making the above changes restart the Apache service.
Verify Short Tags in On
To verify that the short tags are enabled in the PHP configuration. Create a PHP script with the short open tags and access in a web browser or execute from the command line. For example, I have created check.php with the following content.
1 2 3 | <? echo "It's Working!"; ?> |
Now execute this script using the command line or access file in a web browser.
php check.php
You should see the following result if the short tag is
It's Working!
If you can’t find the short_open_tag setting in your php.ini file, or if changing it doesn’t seem to have any effect, it’s possible that your server doesn’t support short open tags. In this case, you’ll need to use ?php instead of ? in your code.
2 Comments
important! string number in config file is near 212
thank you