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
<? works on dev server but not production server
Moderator: General Moderators
-
rberry3000
- Forum Newbie
- Posts: 3
- Joined: Mon Dec 21, 2009 3:48 pm
- 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
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
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?
- 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
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.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?
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
thanks for the info!!