kreut — 2012-07-18T14:44:40-04:00 — #1
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,
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???
kreut — 2012-07-18T17:18:26-04:00 — #2
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?"
cpradio — 2012-07-18T17:29:51-04:00 — #3
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.
kreut — 2012-07-18T17:46:28-04:00 — #4
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".
mittineague — 2012-07-22T17:14:47-04:00 — #5
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
kreut — 2012-07-22T17:17:13-04:00 — #6
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?
mittineague — 2012-07-22T18:52:35-04:00 — #7
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.
kreut — 2012-07-22T21:11:19-04:00 — #8
Thank you for the additional info...