CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   PHP (http://www.codingforums.com/forumdisplay.php?f=6)
-   -   Website Format Issue After Server Migration (http://www.codingforums.com/showthread.php?t=283094)

ocadmin 11-27-2012 07:46 PM

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

Fou-Lu 11-27-2012 08:02 PM

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.

Thyrosis 11-27-2012 08:23 PM

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.

ocadmin 11-27-2012 08:23 PM

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.

Fou-Lu 11-27-2012 08:27 PM

If the HTML source matches yet its rendered differently, that indicates its the CSS. Check that the links aren't broken in the CSS.

ocadmin 11-27-2012 08:28 PM

Quote:

Originally Posted by Thyrosis (Post 1295291)
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

Fou-Lu 11-27-2012 08:31 PM

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).

ocadmin 12-03-2012 03:51 PM

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 -->

Fou-Lu 12-03-2012 03:54 PM

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.

tangoforce 12-03-2012 04:07 PM

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..

Fou-Lu 12-03-2012 04:14 PM

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.

ocadmin 12-03-2012 04:17 PM

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.

Fou-Lu 12-03-2012 04:44 PM

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.

ocadmin 12-03-2012 05:11 PM

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

Fou-Lu 12-03-2012 05:36 PM

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.


All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.