Page 1 of 1
<? works on dev server but not production server
Posted: Mon Dec 21, 2009 3:51 pm
by rberry3000
I have built a site using php 5 on my development server. The php code works on that server with the <? without php after however on my production server the code does not work unless it is like this <?php I am not sure why. both servers have the same version of php on them. I really do not want to go back and update all the pages to add php after the <?.
Thanks
Re: <? works on dev server but not production server
Posted: Mon Dec 21, 2009 3:58 pm
by AbraCadaver
short_open_tags = off in the php.ini of your production server. This is the recommended setting and will be off on many servers. That's why you should be using <?php instead of <? and <?php echo instead of <?=.
Re: <? works on dev server but not production server
Posted: Mon Dec 21, 2009 4:08 pm
by rberry3000
wow that was fast, thanks. I wonder why the setting would be on on the dev and off on the prod server. I am the only person who configures the servers. I find that strange. Is there a reason why the short tags should not be used?
Re: <? works on dev server but not production server
Posted: Mon Dec 21, 2009 4:16 pm
by AbraCadaver
rberry3000 wrote:wow that was fast, thanks. I wonder why the setting would be on on the dev and off on the prod server. I am the only person who configures the servers. I find that strange. Is there a reason why the short tags should not be used?
If I remember correctly it interferes with <?xml version="1.0"?> and the like. If this insn't a concern and you are always in control of your servers then I guess it is fine, but if your app will ever need to be hosted somewhere where you aren't in control then it can cause problems. <?php will work everywhere, <? may or may not.
Re: <? works on dev server but not production server
Posted: Mon Dec 21, 2009 4:41 pm
by rberry3000
thanks for the info!!