Question

Any ideas on how to fix this?

Slim Application Error The application could not run because of the following error:

Details

Type: Mustache_Exception_RuntimeException Message: Failed to create cache directory "storage". File: /var/www/html/Site/vendor/mustache/mustache/src/Mustache/Engine.php Line: 705 Trace

#0 /var/www/html/Site/vendor/mustache/mustache/src/Mustache/Engine.php(591): Mustache_Engine->writeCacheFile('storage/__Musta...', 'loadSource('...')
#2 /var/www/html/Site/index.php(29): Mustache_Engine->loadTemplate('index.html')
#3 /var/www/html/Site/index.php(41): renderTemplate('index.html')
#4 /var/www/html/Site/index.php(56): loadPage('index')
#5 [internal function]: {closure}()
#6 /var/www/html/Site/vendor/slim/slim/Slim/Route.php(441): call_user_func_array(Object(Closure), Array)
#7 /var/www/html/Site/vendor/slim/slim/Slim/Slim.php(1314): Slim\Route->dispatch()
#8 /var/www/html/Site/vendor/slim/slim/Slim/Middleware/Flash.php(85): Slim\Slim->call()
#9 /var/www/html/Site/vendor/slim/slim/Slim/Middleware/MethodOverride.php(92): Slim\Middleware\Flash->call()
#10 /var/www/html/Site/vendor/slim/slim/Slim/Middleware/PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()
#11 /var/www/html/Site/vendor/slim/slim/Slim/Slim.php(1261): Slim\Middleware\PrettyExceptions->call()
#12 /var/www/html/Site/index.php(73): Slim\Slim->run()
#13 {main}
Was it helpful?

Solution 2

Mustache failed to create the directory because the web server (Apache) does not have the current permissions.

chown -R apache:apache /var/www/html/

Applying the above command to the right directory fixed the issue and all the files generated as expected once slim was allowed to create the files.

OTHER TIPS

This is just what it says on the tin. In order to cache compiled templates, Mustache needs to be able to write to the cache directory. If PHP (or the web server process it's running under) can't write to the cache directory, you should create the directory yourself and chown and chmod so that it can.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top