Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-27-2012, 07:46 PM   PM User | #1
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
Website Format Issue After Server Migration

I have been banging my head against a desk for a bit trying to figure this out. I have used firebug and have gone over the code and cannot figure out why after migrating a website to a different cpanel/whm server it displays differently.

Here is new old site on the old server: pmiindustries.com

The new site is at test.pmiindustries.com

does anyone have any idea why it would display different both are running on a linux host. The versions of apache are different but php versions are the same, I am not sure what else would cause this.


Thanks in advance
ocadmin is offline   Reply With Quote
Old 11-27-2012, 08:02 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Won't follow unknown links while I'm here at work.
If you visually see a difference, this is a rendering issue, which may or may not be fixed in a PHP script, but relates directly to the output source.
If the code is identical, and the physical servers have changed, my first guess would be the use of short tags is randomly scattered. Since PHP uses <? and ?>, if short tags are not enabled (they are enabled by default), then HTML will render <? . . . ?> as an output element in your HTML source which will often break the visual layout. Short echo prior to 5.4 is also affected by this directive, so if you have <?= then it will not echo with short tags disabled (unless you are on 5.4+).

So take a look through the HTML source and do a search for <?. Does it have any matches popping up? If so, then either convert those to use <?php (<?= would be <?php echo), or enable the short_open_tags directive in the php.ini or .htaccess.

If you are not moving physical servers (seeing subdomains here), then I'd put my money on a broken CSS link.
Fou-Lu is offline   Reply With Quote
Old 11-27-2012, 08:23 PM   PM User | #3
Thyrosis
New Coder

 
Join Date: Nov 2012
Posts: 72
Thanks: 4
Thanked 11 Times in 11 Posts
Thyrosis is on a distinguished road
I've just checked the HTML output with text_diff, the only thing that popped up was the missing <!-- start header --> end <!-- end header -->.

Funnily enough, the Copyright sign at the bottom is rendered differently too: original server doesn't show it, while the new one does. I'm guessing take a look at the Apache configuration and see what's the difference there.
Thyrosis is offline   Reply With Quote
Old 11-27-2012, 08:23 PM   PM User | #4
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
I dont have any short codes I have the full <?php open tags to start the lines that include the header and footer. One thing about the header is that it is javascript based as it has drop downs and things but i cannot find any reason it shouldn't work.
ocadmin is offline   Reply With Quote
Old 11-27-2012, 08:27 PM   PM User | #5
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
If the HTML source matches yet its rendered differently, that indicates its the CSS. Check that the links aren't broken in the CSS.
Fou-Lu is offline   Reply With Quote
Old 11-27-2012, 08:28 PM   PM User | #6
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
Quote:
Originally Posted by Thyrosis View Post
I've just checked the HTML output with text_diff, the only thing that popped up was the missing <!-- start header --> end <!-- end header -->.

Funnily enough, the Copyright sign at the bottom is rendered differently too: original server doesn't show it, while the new one does. I'm guessing take a look at the Apache configuration and see what's the difference there.
Yeah I just removed those lines trying to figure out what it is

what part of apache would render this different ? I did some comparisoins on the old server and the new and found this:

New: PHP 5.3.18

Old: PHP 5.2.9

New: Zend 5.5.0

Old: Zend 3.3.9

New: Apache: Server Version: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_bwlimited/1.4

Old Apache: Server Version: Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.2.9
ocadmin is offline   Reply With Quote
Old 11-27-2012, 08:31 PM   PM User | #7
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Apache won't render it differently. If the HTML source matches in both locations, this isn't a PHP issue, its a rendering one so its your HTML and CSS that's at fault.
There are a lot of things different between these two servers setups. I haven't a clue what the differences between the Zend application are, but 5.3 and 5.2 have many differences (albeit most are object oriented and 5.3 is mostly backwards compatible with the exception of namespaces and constructors if they match the class names).
Fou-Lu is offline   Reply With Quote
Old 12-03-2012, 03:51 PM   PM User | #8
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
Here is an update

Instead of including the header and footer files I copied the code right into the index and now the formatting is proper. Any idea why this would happen ?

This is the code I was using to include the files:

<!-- start footer -->
<?php include("includes/footer_home.php"); ?>
<!-- end footer -->
ocadmin is offline   Reply With Quote
Old 12-03-2012, 03:54 PM   PM User | #9
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Possibly a filepath issue. That should have no impact if the output source is the same (as you claim it is). Change include to require and it will tell you if it can't read the file.
Fou-Lu is offline   Reply With Quote
Old 12-03-2012, 04:07 PM   PM User | #10
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,516
Thanks: 45
Thanked 440 Times in 429 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
I'm just wondering Fou..

Op says html is the same. Affected HTML is in an included file.. yet when copied out and pasted directly in it fixes the issue...

You reckon it might be an encoding problem like I had months ago? That led to all sorts of strange behaviours for me and it did different things on different servers too.

I could encode it as ansii on my system and all sorts of weird characters would show up but be fine on the remote server.

I'm just wondering if that could be the case here..
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Old 12-03-2012, 04:14 PM   PM User | #11
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
That's possible, but I'd expect that a difference program would also see any bom's that may be added.
The OP could try opening the files in notepad and ensuring its saved in ansi to remove the bom from it.
Fou-Lu is offline   Reply With Quote
Old 12-03-2012, 04:17 PM   PM User | #12
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
I updated my encoding to UTF-8 in Notepad++ alot of the files were ANSI so I made the ones I am working with for now UTF-8

I changed this page: http://test.pmiindustries.com/about-pro-mold.php to require but still no luck.
ocadmin is offline   Reply With Quote
Old 12-03-2012, 04:44 PM   PM User | #13
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Move it back to ansi from UTF-8.
Still smells like either a CSS issue, or the HTML doesn't match as you say it does. BOM usually only affect PHP's ability to send headers (since you can't), so you won't be able to use sessions, cookies, redirections, etc if you save it as UTF-8 unless you use output buffering at an INI level.
Fou-Lu is offline   Reply With Quote
Old 12-03-2012, 05:11 PM   PM User | #14
ocadmin
New to the CF scene

 
Join Date: Nov 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
ocadmin is an unknown quantity at this point
I just converted all of the files that I have in my includes (header, footer etc..) to ANSI and now it works the about page now formats properly. I still dont really understand why that worked but I will do some reading on google
ocadmin is offline   Reply With Quote
Old 12-03-2012, 05:36 PM   PM User | #15
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,661
Thanks: 4
Thanked 2,452 Times in 2,421 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
BOM decimated the output source. You need to use a better program to detect the differences between two strings; BOM are non-printable, but are still chars nonetheless. Pear's text_diff may work if you force it into UTF8, but I wouldn't be surprised if it doesn't either. PHP is not natively supporting UTF8 (unless one of the newer versions is), and I don't expect that it will until 6.0.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:00 AM.


Advertisement
Log in to turn off these ads.