I think you did something wrong in your setup on heroku. Your application shouldn't be running in the /tmp directory to begin with!
You can follow this tutorial if you wish: https://devcenter.heroku.com/articles/getting-started-with-laravel
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello I tried to deploy my Laravel application in Heroku, but it throws an error at the log that It can't put contents to the tmp folder, or create folders there.
I tried to change permissions for the /tmp directory, storage directories and bootstrap/cache, that didn't really work, so any solution for that?
2019-01-27T14:43:36.469522+00:00 app[web.1]: [27-Jan-2019 14:43:36 UTC] PHP Fatal error: Uncaught ErrorException: file_put_contents(/tmp/build_ece70069e449e1b634da61e6a83cf726/storage/framework/views/9e1b8f3c8fac9f2fdc4d2c80c7f806094604e60c.php): failed to open stream: No such file or directory in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
2019-01-27T14:43:36.469540+00:00 app[web.1]: Stack trace:
2019-01-27T14:43:36.469771+00:00 app[web.1]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/app/vendor/lar...', 122, Array)
2019-01-27T14:43:36.470017+00:00 app[web.1]: #1 /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/tmp/build_ece7...', '<?php $__env->s...', 0)
2019-01-27T14:43:36.470305+00:00 app[web.1]: #2 /app/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(122): Illuminate\Filesystem\Filesystem->put('/tmp/build_ece7...', '<?php $__env->s...')
2019-01-27T14:43:36.470566+00:00 app[web.1]: #3 /app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile('/app/vendor/lar...')
2019-01-27T14:43:36.470914+00:00 app[web.1]: #4 /app/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 122
2019-01-27T14:43:36.473056+00:00 app[web.1]: [27-Jan-2019 14:43:36 UTC] PHP Fatal error: Uncaught ErrorException: file_put_contents(/tmp/build_ece70069e449e1b634da61e6a83cf726/storage/framework/views/9e1b8f3c8fac9f2fdc4d2c80c7f806094604e60c.php): failed to open stream: No such file or directory in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
2019-01-27T14:43:36.473136+00:00 app[web.1]: Stack trace:
2019-01-27T14:43:36.473403+00:00 app[web.1]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/app/vendor/lar...', 122, Array)
2019-01-27T14:43:36.473662+00:00 app[web.1]: #1 /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/tmp/build_ece7...', '<?php $__env->s...', 0)
2019-01-27T14:43:36.473953+00:00 app[web.1]: #2 /app/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(122): Illuminate\Filesystem\Filesystem->put('/tmp/build_ece7...', '<?php $__env->s...')
2019-01-27T14:43:36.474228+00:00 app[web.1]: #3 /app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile('/app/vendor/lar...')
2019-01-27T14:43:36.474573+00:00 app[web.1]: #4 /app/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 122
2019-01-27T14:43:36.475814+00:00 app[web.1]: 10.11.189.35 - - [27/Jan/2019:14:43:36 +0000] "GET /api/section HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15
2019-01-27T14:47:39.360572+00:00 app[web.1]: [27-Jan-2019 14:47:39 UTC] PHP Fatal error: Uncaught ErrorException: file_put_contents(/tmp/build_ece70069e449e1b634da61e6a83cf726/storage/framework/views/9e1b8f3c8fac9f2fdc4d2c80c7f806094604e60c.php): failed to open stream: No such file or directory in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
2019-01-27T14:47:39.360710+00:00 app[web.1]: Stack trace:
2019-01-27T14:47:39.361031+00:00 app[web.1]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/app/vendor/lar...', 122, Array)
2019-01-27T14:47:39.361295+00:00 app[web.1]: #1 /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/tmp/build_ece7...', '<?php $__env->s...', 0)
2019-01-27T14:47:39.361597+00:00 app[web.1]: #2 /app/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(122): Illuminate\Filesystem\Filesystem->put('/tmp/build_ece7...', '<?php $__env->s...')
2019-01-27T14:47:39.362253+00:00 app[web.1]: #3 /app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile('/app/vendor/lar...')
2019-01-27T14:47:39.363034+00:00 app[web.1]: #4 /app/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 122
2019-01-27T14:47:39.365047+00:00 app[web.1]: [27-Jan-2019 14:47:39 UTC] PHP Fatal error: Uncaught ErrorException: file_put_contents(/tmp/build_ece70069e449e1b634da61e6a83cf726/storage/framework/views/9e1b8f3c8fac9f2fdc4d2c80c7f806094604e60c.php): failed to open stream: No such file or directory in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
2019-01-27T14:47:39.365320+00:00 app[web.1]: Stack trace:
2019-01-27T14:47:39.366202+00:00 app[web.1]: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/app/vendor/lar...', 122, Array)
2019-01-27T14:47:39.367479+00:00 app[web.1]: #1 /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/tmp/build_ece7...', '<?php $__env->s...', 0)
2019-01-27T14:47:39.368710+00:00 app[web.1]: #2 /app/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(122): Illuminate\Filesystem\Filesystem->put('/tmp/build_ece7...', '<?php $__env->s...')
2019-01-27T14:47:39.369954+00:00 app[web.1]: #3 /app/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\View\Compilers\BladeCompiler->compile('/app/vendor/lar...')
2019-01-27T14:47:39.370265+00:00 app[web.1]: #4 /app/vendor/laravel/framework/src/Illuminate/View/View.php(142): Illuminate\View\Engines\CompilerEngine->get in /app/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 122
2019-01-27T14:47:39.371433+00:00 app[web.1]: 10.61.157.148 - - [27/Jan/2019:14:47:39 +0000] "GET / HTTP/1.1" 500 - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.2 Safari/605.1.15
Please or to participate in this conversation.