Solved

Exporting webproject failure

Posted on 2014-12-27
15
97 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 83

Expert Comment

by:Dave Baldwin
ID: 40520158
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
ID: 40520163
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
ID: 40520175
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40520176
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 83

Expert Comment

by:Dave Baldwin
ID: 40520178
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
ID: 40520184
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
ID: 40520187
PS: you are correct, he does use session variables.
0
 

Author Comment

by:NeverEndingFlashStories
ID: 40520195
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
ID: 40520200
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 83

Expert Comment

by:Dave Baldwin
ID: 40520218
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 83

Expert Comment

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

Author Comment

by:NeverEndingFlashStories
ID: 40520224
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 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40520227
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
ID: 40520231
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 83

Expert Comment

by:Dave Baldwin
ID: 40520240
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

777 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