1

I am running WAMP as a local server for the computers in the my network.

The problem is that when I try to do any operations to the database from these computers, it seems as if they don't happen, even though they do.

I have a mysql table called person with the fields id,lastname,name when I try to add a new person or edit one of them everything seems fine, but when i check to see if the person has been added/edited it seems as if it hasn't, even tough when i check into my database, the changes have been done.

Digging a little further, I realized that when I access to my system via http://localhost/system/ all the changes to the database are reflected immediately, but when I access to the system via IP address http://12.12.123.12/system/, the updates doesn't show up until i close the webpage or hit refresh about 5 times.

httpd.conf

ServerRoot "c:/wamp/bin/apache/apache2.2.21"
Listen 80
ServerName localhost:80
DocumentRoot "c:/wamp/www/"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "c:/wamp/www/">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
    Allow from all

</Directory>

So long story short everything is working on the database side, and when i view my page via localhost everything works fine, the problem is when i access to it from the IP address

FINAL UPDATE
My application had an <iframe> that contained all the necessary forms to display the information, turns out it was the frame the one that wasn't being refreshed so it showed the outdated info. I had to add 2 lines of code so that it wouldn't cache the information and always show the current information. Here is what i added:

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Isaac Gonzalez
  • 113
  • 1
  • 6
  • -1 This really doesn't make any sense. Please consider re-reading this from the perspective of someone that's not you and edit this so that we can make sense of this. I'll check back in a bit and remove my downvote if you've fixed this question. – MDMarra Aug 01 '12 at 19:27
  • I'm sorry someone edited my code and deleted some sentences, i'm updating it again – Isaac Gonzalez Aug 01 '12 at 19:30
  • My comment was from before the edit. Please don't just roll the edit back, put some effort into fixing the question. – MDMarra Aug 01 '12 at 19:30
  • I have just edited it, does it makes more sense now ? – Isaac Gonzalez Aug 01 '12 at 19:36
  • 1
    It makes a little more sense now, but without knowing what the web application is actually *doing* and without seeing your my.conf and httpd.conf, no one is going to be able to answer your question. – MDMarra Aug 01 '12 at 19:37
  • Ok i'm going to add it, sorry i'm new here – Isaac Gonzalez Aug 01 '12 at 19:38
  • I think it makes sense, but I'm not sure there's enough information to provide an answer to it... if that helps. – HopelessN00b Aug 01 '12 at 19:38
  • @IsaacGonzalez it's nothing specific about "here", but if you want help **anywhere**, you need to give good, relevant details otherwise no one is going to be able to do anything. "Help, my web page is slow sometimes" isn't enough to even guess at. – MDMarra Aug 01 '12 at 19:39

1 Answers1

2

If your DB reflects the changes immediately, and accessing the site via localhost reflects them immediately, but changes are slow to appear when accessing externally, my first reaction is that you need to check for caching.

This can get you started with regards to Apache Caching: http://httpd.apache.org/docs/2.2/caching.html

If you are serving through Varnish, that is a cache and reverse-proxy tool as well. Also, your browser may be caching on you, not to mention if you are going through a standard web proxy

gWaldo
  • 11,887
  • 8
  • 41
  • 68
  • 1
    +1. This. My immediate thought after the last edit is client-side caching, or a cache layer installed on the server that the OP hasn't mentioned. – MDMarra Aug 01 '12 at 19:53
  • where is it most likely the caching problem to be on the browser, my code or the server configuration ? – Isaac Gonzalez Aug 01 '12 at 19:53
  • @MDMarra how can i check for that cache layer ? – Isaac Gonzalez Aug 01 '12 at 19:54
  • You can test whether it's your browser by clearing cache and/or using a different browser. – gWaldo Aug 01 '12 at 19:57
  • Also you can test by using `curl` to see the headers returned. – gWaldo Aug 01 '12 at 19:58
  • @IsaacGonzalez If it's your server, hopefully you know if you installed something like memcached... If you don't even know if you've done it yourself, there's little hope that we can help you. Chances are that it's browser cache on the client, though. – MDMarra Aug 01 '12 at 19:58
  • @MDMarra i haven't installed memcached, i'm going to play with the browser configuration, since i have made everything in my code for it not to used cache information – Isaac Gonzalez Aug 01 '12 at 20:01
  • Memcached is for database query caching, and it's use has to be invoked in the application. HTTP caching just needs to be on. – gWaldo Aug 01 '12 at 21:03