Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
1.0k views
in Q2A Core by
I tried to enable cache in admin section but it says that Cache director is not found? Actually, it's not written anywhere that a cache directory is needed to activate cache and exactly where the directory should be placed? Moreover, what "cache" be the exact name of the directory?
Q2A version: 1.8 beta 1

3 Answers

+2 votes
by
I don't have q2a version 1.8 but Did you look at this: https://github.com/q2a/question2answer/blob/dev/qa-config-example.php#L89 ?
by
Thanks a lot for your answer, yes you pointed at the right place but, I am still facing some problem there. Let's see if I get it fixed soon. :)
+1 vote
by
edited by

fara mentioned steps are correct. I enabled cache on http://meta.question2answer.info site, you can test for speed. so far no issues seen.

To enable caching, the following steps need to be taken:

  1. Make a folder to store the cache files and chmod it to 777. Note: for security reasons the folder must be outside your document root. In other words you must not be able to view cache files in your browser like example.com/cache/123abc456def
  2. Set the QA_CACHE_DIRECTORY constant in qa-config.php to the location you made above (see qa-config-example.php for an explanation).
  3. Go to Admin > Caching and tick "Enable caching".
  4. Caching driver-> filesystem

by
I tried to do it as mentioned in qa-config file but it's still not working for me. I am getting "The directory /public_html/qa-cache defined as QA_CACHE_DIRECTORY is not writable by the web server." again and again. Although I have checked that the directory has 755 permission.

Can you please tell that how you made it work? Secondly, what is a caching driver and which one did you choose?
by
I updated above answer, let me know if you still see issue.
by
Thanks a lot ProThoughts, I'll let you know tomorrow morning if it works.
by
Hello @ProThoughts, I tried exactly what you said. But it's still saying that "The directory /qa-cache/ defined as QA_CACHE_DIRECTORY is not writable by the web server.". Although the directory is having 777 permission and still I am getting this error.
by
–1
May below line is still in commented section/* */.  make sure to put below line output side comment section. can you check this again.

define('QA_CACHE_DIRECTORY', '/path/to/writable_cache_directory/');

Like....
 
/*
    If you wish to use caching, you must define QA_CACHE_DIRECTORY to store the cache files. The
    directory must be writable by the web server. It also must be OUTSIDE the public root. For
    example if your site resides in '/var/www/yoursite/public_html', then the cache directory could
    be '/var/www/yoursite/qa-cache', but it cannot be '/var/www/yoursite/public_html/qa-cache'.

*/


define('QA_CACHE_DIRECTORY', '/path/to/writable_cache_directory/');
by
I have written that line outside the comment and also defined the right path. If it wouldn't be outside comment then I would be getting an error like "No directory defined" or something like that.
by
can you PM me exact path which is written in below line
define('QA_CACHE_DIRECTORY', '/path/to/writable_cache_directory/');
by
after giving 777 permission also getting error like this,
The directory /path/to/writable_cache_directory/ defined as QA_CACHE_DIRECTORY is not writable by the web server.

I asked my service provider, but they asking to check with web application developer on this. can someone please help on this.
by
–1
this path will be like /var/www/html/yoursite/qa-cache

You can PM me exact path and site, will see why it is not working.

define('QA_CACHE_DIRECTORY', '/path/to/writable_cache_directory/');
by
I'm using q2a v1.8.
I haven't activated a cache. The site directory is: "/ srv / users / serverpilot / apps / geofili / public"

define ('QA_CACHE_DIRECTORY', '/ path / to / srv / users / serverpilot / apps / geofili / public / cache /');
-------
define ('QA_CACHE_DIRECTORY', '/ path / to / srv / users / serverpilot / apps / geofili / cache /');
------
I haven't tried both. The file permissions for the Cache folder are 777.

What kind of path do I have to follow?
by
not working any method
+1 vote
by

1: Edit the path of the cache file

The path to the correct path should be modified in the config.php file

2:The code should become out of "*/"

This is what the code looks like

define('QA_CACHE_DIRECTORY', 'PATH');

You can specify the file path after the third step

3:Select the file in which you want to save cache, for example "qa-config" and given it 777 permission 

4:Now click the right mouse button over the file you wish to save inside.

And choose the option shown in the picture

A new page will open for you, inside the full path link to this file

Copy and paste it instead of the word PATH in step two

I hope to be of benefit to you

...