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???

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

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.

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”.

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”?>

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?

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.

Thank you for the additional info…

-Eric