The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Prevent CGI cashe, How do I prevent my PHP code being cached
Patrick666
post Feb 8 2010, 07:28 AM
Post #1





Group: Members
Posts: 5
Joined: 8-February 10
Member No.: 11,028



I have piped the email support@myservername to my PHP code at ticketscript/createticket.php (which is above web)
I know that createticket.php runs because I output to a text file and can view that text file.
When I change createticket.php the old version still runs with my old mySQL Code.
While I am developing createticket.php the cacheing means that 5 minutes testing of SQL can take hours.
Can I prevent this server side cacheing while I am still developing my code.
I do not have command line as I am using CPANEL.
Patrick
Original was posted in Client Side by mistake
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Feb 8 2010, 08:23 AM
Post #2


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



This sounds very strange. What exactly does CPANEL do? If it enables you to overwrite a file on the server, which is what you would expect, there is nowhere for it to be cached, in general. But your browser might cache the *output* file...

For "program" files where you want no cacheing, the following headers (or similar) might help:

CODE

// ----- Send special headers
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");


Can you use ftp to update the files? Might help to try...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Patrick666
post Feb 8 2010, 08:38 AM
Post #3





Group: Members
Posts: 5
Joined: 8-February 10
Member No.: 11,028



Thanks for reply Brian
Your code looks like it belongs in a file read by a browser.
My code is triggered by an email (piped) It sends an email as well as updating a database and for debugging outputs a text file to the same diractory on the server.
A browser will never see my code.
If I view and edit the text file output from my code is has in it out of date info.
So the server must running a cached version of my "createticket.php" code.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Brian Chandler
post Feb 8 2010, 10:20 PM
Post #4


Jocular coder
********

Group: Members
Posts: 2,460
Joined: 31-August 06
Member No.: 43



Still doesn't really make any sense (to me at least).

You have a handler registered with the mail agent, so when an email arrives it runs a file, suppose we call it /usr/me/cgi-bin/mailhandle.php. Well, if this is set up correctly, when the mail agent needs to run your program, it runs the file /usr/me/cgi-bin/mailhandle.php. Unless you are using an extremely strange filing system, there isn't anywhere it could be cached.

When you say CPANEL, do you mean you do not have full access to the system? If you use it to write a file, can you actually see a directory listing including the timestamp of the file? That would tell you what is actually happening. If you don't have proper access to the system, that is really the problem...
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Patrick666
post Feb 9 2010, 10:09 AM
Post #5





Group: Members
Posts: 5
Joined: 8-February 10
Member No.: 11,028



Thanks again.
The only reason I mensioned CPANEL was to explain that I do not have command line access.
At the time the development was quite early and I had plenty of errors, my errors. My code is now a lot better and it seems to me that when I have no errors in my code it all runs as you would expect, but when my code crashes it seems bazaar but it acts like code I was using maybe an hour ago, definately not my current code. As my code is now hopefully bug free it is all fine. So I guess there is a cache somewhere and it seems to only run when my code has errors. sounds mad, but that is how it seems.
Anyway, I am happy to leave it at that because as long as my code doesn't fall over everything is OK.
Cheers
Patrick
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 01:55 PM