Funky Cache (beta testers wanted)
|
291 posts
|
Have you copy and pasted the mod_rewrite rules Funky Cache needs to .htaccess? You can find them from “Your .htaccess file”. Maybe your system cannot create folders? Try to create one folder manually to check. For example if you have:
And foo.html is what you describe as parent page and bar.html does not get cached. Then do the following:
Now request /foo/bar.html and see if it gets cached. |
|
184 posts
|
Manual folder creation works … seems your suspision that my system cannot create the folders is partly correct. The file manager plugin and other plugins I have tried can create folders fine, so I don’t think it is my ‘system’ but rather how Funky Cache creates them … any ideas why Funky cache’s method might be any different? Debug is stating that the mkdir function has been passed an invalid argument on line 52. I assume that is because the expected $dir value is not being passed for some reason!? If I trace the $dir value before that line, I notice something that is surely odd. The system path is preluded by a / character … in my case, I’m running the script on a Windows machine, thus this is an invalid value as nothing should prelude the drive letter in the path. |
|
184 posts
|
I removed the preluding / character from the $dir value on line 51 to get a proper path value, but no folder is created and now I get a file_put_contents warning on line 63. I also wondered, is it normal behaviour for the cached pages to display just the doctype line in the html page before it is properly called upon? |
|
291 posts
|
Ah sorry did not read the previous one. I do not test for windows. Problems are most likely caused by my code using *NIX directory separator. Basically all instances of “/” should be “\” in Windows. Can be fixed by using DIRECTORY_SEPARATOR PHP constant. Will fix later when I come back from the holidays (next week). |
|
184 posts
|
I’m running Windows XP and all folders have full permissions on my machine. |
|
184 posts
|
System directory problem … definately. After you highlighted that I found a bunch of folders in the root of the drive that were definately attempts at creating the folders. |
|
541 posts
|
little suggestion for you tuupola for the moment the easiest way to know if you are in backend or not is the check if FROG_VERSION is defined
nice job by the way :) well coded |
|
76 posts
|
I’ve been working a bit on trying to get this plugin to work properly when you configure Frog without a page suffix. The way I intend to do this is to create the folder structure, with an index.html page to hold the page content. Example:
I started out doing this with a Frog setup in a subdirectory; but due to the way Apache/htaccess handles the REQUEST_URI/REQUEST_FILENAME – I don’t think it’s possible for it to distinguish between the directory that Frog is installed at and the URL of Frog’s page/subpage you want. I have it slightly working – domain root (not subdirectory) with basic pages and no plugins. The code expects that there is no URL suffix – i.e. it is likely not to work with it set to .html. FilesNew models/FunkyCachePage.phpHtaccess
The above entries should go between Frog’s admin rule and the main Frog rule. |
|
541 posts
|
here is a other recommendation to make it more portable in your model FunkyCachePage.php, replace the document_root to FROG_ROOT like this:
EDIT: you like to complicate your life Craig ;) |
|
76 posts
|
Hehe. Thanks philippe. Forgot about that ;) |
|
541 posts
|
:) your welcome |
|
291 posts
|
You mean it is not working properly? What is the problem you are trying to solve? |
|
76 posts
|
@tuupola: Sorry; it does work! Because my Frog URL suffix was empty; I thought the Funky Cache plugin suffix also had to be empty – which didn’t work. An empty Frog suffix and a .html Funky Cache suffix works as expected :) |
|
184 posts
|
A suggestion for Funky Cache (in addition to supporting *nix and windows file systems) could be to have a trawling script to auto-regenerate flat html pages for all the pages. At present, if you change a page, the cached page will display blank on first visit until it is then viewed a second time (when the cached version will have then been created). Obviously, for a large website, the webmaster would currently have a lengthy job of needing to re-visit all the pages to ensure that all pages are re-cached, so as to ensure visitors view the cached pages correctly on first visit. |
|
291 posts
|
Then there is something wrong with your system. Page should display just fine the first time it is requested. (Page displays just fine on all of my systems).
If needed you can do it by issuing following command from shell:
But as I said there is something broken in your system if first request gives you blank. |
|
184 posts
|
Hi Tuupola, I’m thinking of running this on my live linux box to see if it works any differently to my local windows box. It is such a handy plugin, I think I need to give it some more time to do it justice. I will post back if I have a different experience with it then. |
|
291 posts
|
I forgot you were running Windows. I do not test with it and it is quite possible my code has bugs in Windows. If you find a solution let me know and I will include the fix. |
|
184 posts
|
Hi Tuupola, I’ve been testing with our live servers and there is still definitely something wrong in caching child pages. I can still only cache parent pages. Running Linux with PHP 5.2.10 and MySQL 5.0.81 |
|
291 posts
|
BlueFrog: What are your Frog settings, Funky Cache settings and .htaccess file. Most likely there is something messed up in one of those. |
|
184 posts
|
Frog settings: define(‘DEBUG’, false); Funky cache settings: Cach by default = yes htaccess: php_flag magic_quotes_gpc off As you can see, all defaults are set. Surely it must still be a problem in creating the folders … even on non-windows servers. I’ll switch debug on and see what I get. |
|
184 posts
|
Aha, debug is telling me that “open_basedir restriction in effect” … can this be overridden? or are we looking at potential hosting limitation with Funky Cache? By the way, on a positive note, I no longer see blank pages when viewing the parent pages for the first time on this Linux server. |
|
291 posts
|
Check the PHP manual. I guess you can turn it off by adding the following to .htaccess (if your host allows that):
Safe mode usually breaks lots of things. It will be removed in PHP 6. |
|
184 posts
|
That didn’t work for me, Tuupola. I’m getting our server aadministrators to look into it for us and will hopefully have an update, as I am determined to ensure this things works. |
|
184 posts
|
I have the openbase restriction sorted, but there is still a problem making directories. I have also been advised not to use the script if it can’t work within openbase restrictions, for security reasons. I personally think the directory creation method could do with a re-think, to ensure it can work across different servers. As it is something I am keen to see working, I will see if I can have a go at coming up with a working solution, perhaps one that works on a Windows server too. |
|
291 posts
|
Personally I have no interest in writing workarounds for PHP safe mode. Safe mode is known to cause all kind of problems, especially scripts which access the file system. After all that is one point of safe mode, to restrict what script can do. I vote with my wallet and never use any host which forces usage of safe mode. That said, if you can find an easy solution and make a patch I will be happy to include it. |