Results 1 to 3 of 3

Thread: Code requires <?php to process

  1. #1
    Join Date
    Mar 2005

    Code requires <?php to process

    I've installed Apache 2.2 with PHP 5. On other machines, with these same versions, I've always been able to put PHP code in my web files with <? and ?>. With this installation, however, for some reason any code between <? and ?> fails to be executed by the PHP module. Only code between <?php and ?> is executed.

    Why would this be, and how can I configure it so it will do as I expected?

  2. #2
    Join Date
    Mar 2005
    This thread and it's predecessor have been rather lonely, since I keep answering my own question before anyone has a chance to respond!

    I found this directive in php.ini:

    short_open_tag = Off
    This is what was disabling the use of <? So naturally I turned it on, and finally everything worked.

    It's possible I used php.ini-recommended with this installation but used php.ini-dist in the past. php.ini-dist has this turned on by default.

    On this topic, what are the other important differences between the two ini files?

  3. #3
    Join Date
    Aug 2004
    As far as using the short_open_tag option, this has had its default set to OFF for quite a few releases now for a reason: it conflicts with the <?xml tag. Also, as you have found out, depending on it makes your scripts less portable as they become dependent on that PHP setting be set to a non-default value. If you always use the long <?php tag, you can then carry on without ever worrying about that configuration setting.

    With regard to other settings, the biggest "gotcha" is old-fashioned scripts which depend upon register_globals being turned on. See http://www.php.net/register_globals for more info on what it does and why the default was changed to OFF.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles