Link to home
Start Free TrialLog in
Avatar of NeverEndingFlashStories
NeverEndingFlashStories

asked on

Exporting webproject failure

Hi,

I am inheriting someone else's web project - and so that i won't be messing up the production copy, I've imported the MySQL tables and data into local host. I've also FTP the site over.

After changing the mysql globals value to reflect the new localhost admin and password, i logged into my local copy of the site.

One of the page broke - seems like every error message created for the page is thrown into the page. In the developer console, the only error message is : Failed to load resource: net::ERR_CACHE_MISS

I googled for this, but seems like people are of the opinion that the error is related to chrome, so i do not think its relevant to my problem.

My page breaks on chrome or firefox, using files and database data that i have just imported and copied over from production, which works just fine.

Is there a step that I may be missing when copying over a site? Something i may have overlooked? I know this is terribly open ended question, but I am not quite sure where to start. PHPStorm does not throw an error in the code itself, the console shows only the one error, but the whole page is throwing all sorts of php code and error messages from the code itself.

Thanks....
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Is this a Wordpress site?  There are a lot of things that fail on 'localhost' including cookies in Chrome.  Try running it with the IP address of your machine and/or web server.
Avatar of NeverEndingFlashStories
NeverEndingFlashStories

ASKER

No, its a normal PHP site - using some foundations 5, i believe.
My web server/mysql is installed using XAMPP
I have tried 127.0.0.1 as per your suggestion, the error persists.
I have also tried firefox.
I also believe the developer didn't use any cookies.
Any other thoughts?
Ok,

So, I've analyzed the developer's code, and for some reason, it looks like he has a <div> codes <div> that should be part of a different page that is in the breaking page.

The only reason I can think of , is because he may have copied the other page as a template?
Removing the whole <div> seems to fix the broken page...(not sure if it will break anything else).

Why would this be an error on my localhost, but not in the production server?
Not 127.0.0.1 (since that is still 'localhost') but the network IP address of the machine.  I don't even have a 'localhost' or 127.0.0.1 connection on this machine because it is very limited in it's usefulness.  The network IP address of the machine I am on is 10.20.46.40 and that's what I use to access the web server on this machine.  

I know there is a lot of sample code out there that uses 'localhost'... but it fails a lot of times also.  And there is no 'localhost' on the internet since by definition, 'localhost' is only on your machine.  'localhost' on another machine is only on that machine.

Sessions use cookies and you are most likely using PHP sessions.  If you can't use cookies then you can't use Session variables.
If it was just a <div> with only HTML, it wouldn't 'break' the page although it may make it look funny.
Hi Dave,

Sorry, i am a little bit slow - I was not a web developer til about a month ago when the three projects suddenly falls into my lap. Still learning the basics of php/html/css/mysql/javascript all at once.

That said, how do I find my network ip? I am having difficulty understanding what you mean by not using localhost. To clarify, the production page is on a completely different server. The production page did not break.
 
The localhost is on my own computer at home. This is the one that breaks.

I guess i am also not quite sure what the definition of a broken page is, i just sort of used it earlier. This is a screenshot of how the page looks like. I think its broken, but it may also just look funny...
error.png
PS: you are correct, he does use session variables.
PPS: Looking at the error screenshot i attached - in the first line - you can see that the php comments are all included. Which is a little weird, because commented out code should not be displayed like that, i think?
Hi,

I've figured out the issue - but not the solution, or why it has happened. When inspecting the error in my html, this is what shows up on the browser (see file attached).

Apparently, the browser adds the following to part of the block of code inside the div :

<!--?

Which comments out only part of the code. Why would it do this? I have googled around, but it doesn't seem conclusive. One responds is that my localhost server is not setup to handle php files, but i know it does, as i have another php project on the go that works. User generated image
This <!--? is not a comment in PHP.  And it is not an opening tag for PHP either which is why the code is showing up in your browser.  

It looks like you are using Chrome to run your pages.  Are you using some development program also?

This site http://php.net/ is the reference for all PHP.  This simple PHP program will tell you everything that your installation of PHP knows about itself.  Save it to your web root directory as 'phpinfo.php' and run it in your browser.
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);

?>

Open in new window

What version of PHP is running on your server and what version on you local machine?
Hi Dave,

- The error also shows up on Firefox.
- The comment is an HTML comment right after the <div> - and it is not in the actual PHP file...it looks like it gets added later by something?
- I am using PHPStorm IDE, but the error showed up before I even do anything to the original code. The original code was written using Notepad++
- on my local machine, the PHP is running 5.5.15
- on the server, its running 5.3.3

Thoughts?
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Dave,

yes, the phpinfo.php file run okay. It gave me a long php info page.

Thanks for your efforts. I am finding more and more problems down the pages, seems like the original developer ignored a lot of notices, which is now showing up in my installation.
Sigh.
I may have to just do the work i need to do on the production site - otherwise i will end up having to fix up all the mess first. Which is really ideal, except my deadline does not allow me to do so.
You're welcome.  You know you'll have to do all that eventually anyway.  Preferably before your web host moves to a newer version of PHP.