PHP Short Opening Tag not supported… null problemo!

January 20, 2008 – 9:28 pm

Here’s another config - particularity of PHP, right up there with my beloved register_globals run-ins and $_REQUEST access issues..
Recently I’ve had to deploy a site on a server that had short opening tags disabled, and no access to the php.ini. Wow, didn’t see that coming.

Now, for my scripts that didn’t really mean a thing, since I habitually start a multi-line php code block with <?php, however, I do like using <?= within my “templates” (or view files), rather than <?php echo, because, well it keeps things “template-ier” IMHO. Almost as short as the smarty tag, eh? ;)

So what to do avoid string replacing the hell out of your front-end?

Luckily, you can use the .htaccess file to set directory specific configuration. Simply put

php_flag short_open_tag on

somewhere in there, and things start working, IF your server administrator allows it, which should be the case..

That being said, I realize this is a quick fix, and in code meant for distribution I would probably use string replace before shipping, just to make sure things work right out of the box.

Here’s a question: I read somewhere that using the runtime version

ini_set('short_open_tag', 1);

withing your code doesn’t seem to work. I haven’t tried it for myself.. maybe somebody can comment on that?


Filed under: Rnadom Sftuf — by Richtermeister

2 Comments »

  1. found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later ..

    Comment by How To Run Php Scripts — June 4, 2008 @ 11:48 am


  2. CheapTabletsOnline.com. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. No prescription pills. Buy pills online

    Buy:Wellbutrin SR.Buspar.Amoxicillin.Nymphomax.Zetia.Acomplia.Lasix.Aricept.Female Pink Viagra.Seroquel.Lipothin.Cozaar.Female Cialis.Benicar.Lipitor.Zocor.Prozac.SleepWell.Ventolin.Advair….

    Trackback by REX — September 6, 2010 @ 11:23 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress