How to Enable PHP Short Tags

How to Enable PHP Short Tags thumbnail
You'll need to edit your php.ini file to enable short tags.

PHP "short tags" or "short open tags" use a shorthand delimiter for PHP code. Instead of fully typing "<?php" to denote a section of code, you type only "<?". PHP phased out short tags in version 5, and their use is no longer recommended. However, for backward compatibility with applications written for PHP4, you can still edit your php.ini file to allow short tags.

Instructions

  1. General Online Hosts

    • 1

      Locate your php.ini file. If you are unsure where it is, contact your hosting provider for the exact path. If your host uses cPanel, you may be able to access it directly there or submit a support request to enable short tags.

    • 2

      Open php.ini and locate the line "short_open_tags=off." Change "off" to "on" and save the file.

    • 3

      Restart Apache. Usually you will not need to do this, but sometimes your server will need to be restarted to take the changes. Unless you are running a dedicated server, contact your hosting provider for assistance.

    Local WampServer

    • 4

      Start WampServer.

    • 5

      Locate the Wamp icon in your system tray and left-click it once. The icon is shaped like a semicircle or rainbow.

    • 6

      Open the "PHP" menu and hover over "PHP settings."

    • 7

      Click "short open tag." This should be the first item in the list.

Tips & Warnings

  • It's best to submit a support request to your Web host to enable PHP short tags.

  • The PHP "best practice" for short tags is to remove them from your application. Therefore, you should only set shorts tags on for as long as it takes to resolve the conflict.

  • The use of PHP short tags is not recommended if your host runs PHP5 as it can cause compatibility issues should you ever need to switch hosting providers.

Related Searches:
  • Photo Credit Jupiterimages/Photos.com/Getty Images

Comments

Related Ads

Featured