Disable cache in shared hosting Fat Free framework - debugging

I cannot get to disable cache in shared hosting. When I set
$f3->set('DEBUG', 3);
$f3->set('LOCALES', 'lang/');
$f3->set('AUTOLOAD', 'app/controllers/');
$f3->set('UI', 'app/views/');
$f3->set('CACHE', FALSE);
$f3->clear('CACHE');
$cache->reset();
Cache still working and I cannot properly debug

Thanks it was due to Zend OPcache module. All I need is to insert
php_flag opcache.enable Off into .htaccess file

Related

ServiceStack selfhosting disable caching for memory

Using Selfhosting standard ServiceStack MVC Application every request get cached in the memory. Changing any js file have no conscience until i restart the server.
Is there any way around this problem for developing purposes?
Every request does not get cached in memory, when you're self-hosting it's running the binary dlls and static files that are copied into your /bin folder.
You can change Config.WebHostPhysicalPath to change ServiceStack to serve files from your solution folder instead, e.g:
SetConfig(new HostConfig {
#if DEBUG
DebugMode = true,
WebHostPhysicalPath = Path.GetFullPath(Path.Combine("~".MapServerPath(), "..", "..")),
#endif
});

In Grails, disable name hashing but keep expires header for hashandchange resources plugin?

I am using grails resources plugin. On client I am using require.js to fetch js.
my require.js config -
baseUrl: '/js/lib',
With resources plugin enabled -
browser would make request for /js/lib/abc.js wasting ~300ms
On reaching server it will be redirected to /static/2432yi4h32kh4232h4k2h34ll.js
Browser will find this file in its cache and serve it.
So I disabled cached-resources plugin using -
grails.resources.mappers.hashandcache.excludes = ['**/*.js']
and new require.js config -
baseUrl: '/static/js/lib',
urlArgs: "bust=" + application_version,
Removing cached-resources solved redirect issue but also removed the expires header which was being set for js files causing browsers to not cache js files at all.
How can I only disable the name hashing in cached-resources and keep the expires headers it sets.
Otherwise, are there any plugins for Grails I can use to set these headers and they work well with Resources plugin.
I am using Tomcat and Haproxy to serve content.
I think best solution is to put the hashed js file name in require definition, not the original clear name.
You can echo the hashed name using the resource external tag
<r:external uri="js/custom.js"/>
<script type="text/javascript">
var urlOfCSSToLoadInJSCode = '${r.external(uri:"css/custom.css").encodeAsJavaScript()}';
</script>
<r:external uri="icons/favicon.ico"/>

Disable caching of the config details in Symfony2

We have several sites, each site has its own database and url.
All sites are using an API written by Symfony2. The database configuration in Symfony is in parameter.php file, which set the database parameters according to the current site.
As a result, every request to Symfony can be from different database, which means, the configuration should be loaded every time.
The question is how to disable the caching of the config parameters.
Or, if there is other idea, how to keep caching and to find a way to create caching per site, I would be happy to hear.
Thanks.
I ended up creating a separate cache directory for each site. This way the configuration parameters are saved in the cache per site.
Here is how to override the cache directory:
http://symfony.com/doc/2.1/cookbook/configuration/override_dir_structure.html
I just added the following to the AppKernel.php file:
public function getCacheDir()
{
$request = Request::createFromGlobals();
return $this->rootDir . '/cache/'. $this->environment .'/' . $request->getHost();
}

Varnish Cache and Magento: Guru Meditation and 500 Internal Server Error?

I recently activated the varnish cache module for my Magento store, this worked pretty well, no problems. Now I copied the code and the DB of this Magento installation and placed it somewhere else on the same server to create a testing environment. I deactivated varnish cache on that testing environment by setting system/varnishcache/enabled to 0 and system/varnishcache/disable_caching to 1.
The problem now is, that I always get:
Error 500 Internal Server Error
Internal Server Error
Guru Meditation:
XID: 628339795
No matter what I do, I cleared the cache, reloaded, tried different browsers, activated the varnish cache module, doesnt help. Any ideas what else I could try?
Thanks!
By default Mageto switches errors output off. If your php is configured not to log php errors web server will send 500 error in case any fatal error occurs.
You can check errors in /var/log/exception.log and /var/log/system.log or enable output of all errors in your magento installation:
edit your index.php :
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
and .htaccess:
SetEnv MAGE_IS_DEVELOPER_MODE "true"

apc.filter in APC

I'm trying to use such function as apc.filter in APC.But all, that i have done, didnt work
There are 2 task that I should done.
1)Need to include 1 catalog for caching.My code in apc.ini
apc.cache by default Off
apc.filter = "+/path1/.*"
Such option doesnt work.It's still caching
2)Need to exlude 3 catalogs on the server that shouldnt be cached,for example my code in apc.ini for such task
apc.cache by default On
apc.filter = "-/path1/path2/.*,
apc.filter = "-/path3/path4/.*,
apc.filter = "-/path5/path6/.*"
Can somebody help me with it?plz
apc.filter does not work for absolute path
http://www.php.net/manual/en/apc.configuration.php#ini.apc.filters
You can try to enable/disable apc for particular folder by using .htaccess directives.
In my case I need to disable APC cache for whole site, so I put the following into root .htaccess:
php_flag apc.cache_by_default Off
And it works perfect.
I think you've made a typo: it's apc.filters not apc.filter
For an example of what you're trying to achieve:
apc.filters = /path1/path2/.*,/path3/path4/.*,/path5/path6/.*
should do the trick, with a default cache set to On.
I wanted to do the same thing for my development environment. Since both production and development code were there on the same server, I wanted a way not to cache "test" directory.
I tried using
apc.filters -/my loc/my_test/.*,-/full_path/my_test/.*
But this does not work. The simplest fix is to modify .htaccess in your directory that you want to block being cached
<IfModule mod_php5.c>php_flag apc.cache_by_default Off</IfModule>
And it works beautifully.:)

Resources