If these settings should not be modified in any way while your script is running, it might be a little safer to define them as constants. In this case, "safer" probably isn't so much an issue of preventing malicious changes as it is to prevent inadvertent changes by your code or third-party code you are utilizing.
<?php
define('CACHE_DIR', 'cache_directory');
define('TEMPLATE_DIR', 'template directory');
?>
This has the added benefit that constants are automatically in the global scope.