I had an issue recently with some shared hosting and W3 Total Cache; basically the root path wasn’t being declared correctly via the default configuration of the plugin. I came up with a slight modification to the /inc/define.php file (DISCLAIMER: this is a hack, if you use this your warranty is void / bad things may happen):
Original code:
function w3_get_home_root() {
if (w3_is_network()) {
$path = w3_get_base_path();
} else {
$path = w3_get_home_path();
}
$home_root = w3_get_document_root() . $path;
$home_root = realpath($home_root);
$home_root = w3_path($home_root);
return $home_root;
}
Code language: PHP (php)
Modified code:
function w3_get_home_root() {
if (w3_is_network()) {
$path = w3_get_base_path();
} else {
$path = w3_get_home_path();
}
//$home_root = w3_get_document_root() . $path;
//$home_root = realpath($home_root);
//$home_root = w3_path($home_root);
<em>$home_root = '/var/sites/YOURSITE/public_html';
</em>return $home_root;
}
Code language: PHP (php)
As you can see; it basically involves hard-coding the path to your root directory. 9/10 this won’t affect you but on some shared hosting this problem can occur (you’ll get errors in the W3TC control panel about root paths not being set).