SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    PHP not parsing on remote server on some files...

    Hello!

    In the past day or two I've been spending a lot of time getting a backup file system in place and tried to add additional security to my website. "All of a sudden", php is being parsed in some of my php scripts, but in others, it's simply printing the result to the screen. Is it possible that I somehow changed execute permissions somewhere or might there be another cause? And if so, what's the best way to debug?

    Thanks so much,

    Eric

    PS UGGGHHHH...now I'm having the same problem locally. Could I be somehow saving the files in a way that servers interpret the them as text as opposed to php???

  2. #2
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Found the problem....But why the heck does it fix it?

    Hello!

    I made this post a few hours ago after spending many hours looking for the problem. It turn out that some of my starting tags were "<?" as opposed to "<?php"; they worked fine up until now, but all of a sudden, my hosting server couldn't interpret them. So....

    1) I offer this as a warning to other PHP newbies: <? worked fine with my local server but not on my remote server
    2) I now pose another question: "What could have changed on my hosting server that makes this an issue all of a sudden?"

    -Eric

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,063
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Using short_tags (the <?) is a php.ini setting that hosting servers could turn off. I always use <?php as that can't be turned off.

  4. #4
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick response! I JUST found out that my account was in fact migrated to a different server. Hopefully this can be a warning for those of us who can get a bit "lazy".

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,017
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    The reason I don't use them isn't because they might get turned off, but because I don't want to introduce potential problems with
    <?xml version="1.0"?>

  6. #6
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yikes!

    1) When you say "potential problems"...might you care to elaborate?
    2) If I'm on a shared host, aren't I at the whims of my hosting service regarding the php .ini file?

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,017
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    Unless you're working with XML files (or might be in the future), it's mot a problem. That's why I said "potential".

    If the PHP parser ever comes across an XML declaration and short tags are enabled it will throw a nasty error message at you.
    "string literal" or some such, I forgot.

    Anyway, it's just another reason to not use short tags.

    I'm not even sure why there is such a thing. To let programmers save a few characters? I don't think so. My guess is it's because other languages have similar syntax and PHP "copied" it.

  8. #8
    SitePoint Evangelist
    Join Date
    Mar 2011
    Location
    Bellingham, WA
    Posts
    450
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the additional info...

    -Eric


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •