Solved

Exporting webproject failure

Posted on 2014-12-27
15
96 Views
Last Modified: 2014-12-27
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....
0
Comment
  • 8
  • 7
15 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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.
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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?
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
If it was just a <div> with only HTML, it wouldn't 'break' the page although it may make it look funny.
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
PS: you are correct, he does use session variables.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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?
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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. Picture of error from console
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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

0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
What version of PHP is running on your server and what version on you local machine?
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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?
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
Comment Utility
I suggest you use Notepad++ at least until the basic code runs.  Many IDE's add their own code to files.  I don't use any of them.  

There are differences between PHP 5.3.3 and PHP 5.5.15 and there is no easy way to tell whether they are part of your problem.  

Did the 'phpinfo.php' file run ok?

How to find your local IP address: https://kb.iu.edu/d/aapa
0
 

Author Comment

by:NeverEndingFlashStories
Comment Utility
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.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
Comment Utility
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.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now