<?php header oddity with PHP5 on windows server.
Posted: Fri Sep 02, 2005 11:43 am
I had been using Windows XP with Apache 1.3.x and PHP 4.3.x and MYSQL 4.1.x for a long time. This is my dev PC, eventually hosted on a Linux webserver. I recent started working on an app that deals with birthdays and was testing for dates pre-1970 and some other date formattings. Found that PHP 4.x on windows and some linux boxes has an issue with pre Unix Epoc dates. So I saw that PHP5.1RC1 fixed that for the windows platform.
So I decided to update my Apache and PHP to Apache 2.0.54 and PHP 5.1.0 RC1. Leaving MYSQL at 4.1.7. Everything works now with the new Apache and PHP5.... but now there is an oddity for php scripts.
Before I have always been able to start a php script with just <? instead of <?php, not the best habit I guess. But since my php files always are named something.php and I don't mix inline code, I don't see a reason to always state <?php everytime I break in and out of php in a php file. Anyways, that has always worked fine. Until now.
Now in PHP5.1RC1 on windows, if I start with <?php in the sript, then it works fine. But if I just start with <? then my PHP code displays instead of being executed. I guess it could be an apache issue, but it seems that since apache is only looking at the file name extension to determine what will parse it, then it should mean that it's php that is reading the <? and deciding not to execute the code.
So I am wondering, is the a setting for php.ini to control this for PHP5.1? I am hoping this thread does not turn into an argument about <?php vs <? for a something.php file. Hopefully someone else has seen this issue too. And does anyone have a Linux PHP5.1RC1 Apache 2.0.x setup that they could test this oddity on? I am curious if it's just a windows php5 issue or all platforms. Or just a php.ini setting that can be altered to work like my default php4.3.x setup. Thanks again.
So I decided to update my Apache and PHP to Apache 2.0.54 and PHP 5.1.0 RC1. Leaving MYSQL at 4.1.7. Everything works now with the new Apache and PHP5.... but now there is an oddity for php scripts.
Before I have always been able to start a php script with just <? instead of <?php, not the best habit I guess. But since my php files always are named something.php and I don't mix inline code, I don't see a reason to always state <?php everytime I break in and out of php in a php file. Anyways, that has always worked fine. Until now.
Now in PHP5.1RC1 on windows, if I start with <?php in the sript, then it works fine. But if I just start with <? then my PHP code displays instead of being executed. I guess it could be an apache issue, but it seems that since apache is only looking at the file name extension to determine what will parse it, then it should mean that it's php that is reading the <? and deciding not to execute the code.
So I am wondering, is the a setting for php.ini to control this for PHP5.1? I am hoping this thread does not turn into an argument about <?php vs <? for a something.php file. Hopefully someone else has seen this issue too. And does anyone have a Linux PHP5.1RC1 Apache 2.0.x setup that they could test this oddity on? I am curious if it's just a windows php5 issue or all platforms. Or just a php.ini setting that can be altered to work like my default php4.3.x setup. Thanks again.