<? works on dev server but not production server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rberry3000
Forum Newbie
Posts: 3
Joined: Mon Dec 21, 2009 3:48 pm

<? works on dev server but not production server

Post 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
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: <? works on dev server but not production server

Post 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 <?=.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
rberry3000
Forum Newbie
Posts: 3
Joined: Mon Dec 21, 2009 3:48 pm

Re: <? works on dev server but not production server

Post 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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: <? works on dev server but not production server

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
rberry3000
Forum Newbie
Posts: 3
Joined: Mon Dec 21, 2009 3:48 pm

Re: <? works on dev server but not production server

Post by rberry3000 »

thanks for the info!!
Post Reply