11

Can I enable PHP short tags without touching any configuration files?

Dave
  • 498
  • 2
  • 7
  • 22
rajanikant
  • 179
  • 2
  • 3
  • 5

5 Answers5

28

You should be able to change it in your .htaccess file if it wasn't locked down

<IfModule mod_php5.c>
  php_value short_open_tag 1
</IfModule>

See http://php.net/manual/en/configuration.changes.php for more details

Erik Giberti
  • 1,235
  • 9
  • 11
4

If you have access to an .htaccess but not the php.ini, simply add this to .htaccess in root of the php app you are planning on running:

php_value short_open_tag 1
Ram kiran Pachigolla
  • 20,897
  • 15
  • 57
  • 78
4

I think the short_open_tag can't be modified with ini_set().

  • 3
    "`short_open_tag` is marked as PHP_INI_PERDIR in PHP <5.3.0, which means you can't change it with `ini_set()`" http://stackoverflow.com/questions/5633301/cannot-turn-off-short-open-tag-with-ini-set – Geo Dec 26 '12 at 19:04
0

Checkout this previous Questions:
How to enable PHP short tags - Manual Setting

You can use ini_set function for setting programmatically

Revised: I try using ini_set function to configure it but failed. You can check previous questions for better answer.

Community
  • 1
  • 1
Joko Wandiro
  • 1,957
  • 1
  • 18
  • 28
-1

Add into your .htaccess file,

php_value short_open_tag 1
phponwebsites
  • 651
  • 6
  • 9