title: Laravel Permission Denied
body: <p>Tonight, I tried to run <code>composer install</code> and all the dependencies installed correctly, and then composer ran <code>php artisan clear compiled</code> and I ran into trouble.</p>
  <p>Here's the error it returned:</p>
  <pre><code>&gt; php artisan clear-compiled
  
                                                                                                                            
    [ErrorException]                                                                                                        
    file_put_contents(/srv/something/site/bootstrap/cache/services.php): failed to open stream: No such file or directory  
                                                                                                                            
  
  Script php artisan clear-compiled handling the post-install-cmd event returned with an error
  
  
                        
    [RuntimeException]  
    Error Output:       
                        
  
  
  install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [&lt;packages&gt;]...
  </code></pre>
  <p>Naturally, I googled it and found everyone on the <a href="https://laracasts.com/discuss/channels/general-discussion/cant-composer-update-1" rel="noreferrer">laracast forums</a> saying to make the directory I was missing, so I did and the command ran again fine.  When I went to any page I got this: <code>file_put_contents(/differentNameDependingOnPageButAlwaysRandomLettersAndNumbers.php): failed to open stream: Permission denied</code></p>
  <p>For example here's the traceback for the login page:</p>
  <pre><code>ErrorException in Filesystem.php line 81:
  file_put_contents(/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php): failed to open stream: Permission denied
  in Filesystem.php line 81
  at HandleExceptions-&gt;handleError('2', 'file_put_contents(/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php): failed to open stream: Permission denied', '/srv/something/site/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php', '81', array('path' =&gt; '/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php', 'contents' =&gt; '&lt;?php $__env-&gt;startSection('title'); ?&gt; Admin Login &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('form'); ?&gt; &lt;form class=&quot;form-horizontal&quot; method=&quot;POST&quot; action = &quot;login&quot;&gt; &lt;?php echo e($error); ?&gt;&lt;?php /*TODO this doesn't show up now, when you do login make it show up*/ ?&gt; &lt;fieldset&gt; &lt;!-- Form Name --&gt; &lt;h1 class=&quot;section-heading&quot; style=&quot;text-align: center;&quot;&gt;Login&lt;/h1&gt; &lt;!-- Text input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;email&quot;&gt;Email&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;email&quot; name=&quot;email&quot; type=&quot;email&quot; id = &quot;email&quot; placeholder=&quot;user@domain.com&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Password input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;password&quot;&gt;Password&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;********&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Button --&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;Submit&quot;&gt;&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;button id=&quot;submit&quot; name=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('message'); ?&gt; &lt;p class=&quot;text-muted&quot; style=&quot;text-align:center&quot;&gt;Don't have an account yet? Click &lt;a href=&quot;../register&quot;&gt;here&lt;/a&gt; to register.&lt;/p&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php echo $__env-&gt;make('auth.partials.master', array_except(get_defined_vars(), array('__data', '__path')))-&gt;render(); ?&gt;', 'lock' =&gt; false))
  at file_put_contents('/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php', '&lt;?php $__env-&gt;startSection('title'); ?&gt; Admin Login &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('form'); ?&gt; &lt;form class=&quot;form-horizontal&quot; method=&quot;POST&quot; action = &quot;login&quot;&gt; &lt;?php echo e($error); ?&gt;&lt;?php /*TODO this doesn't show up now, when you do login make it show up*/ ?&gt; &lt;fieldset&gt; &lt;!-- Form Name --&gt; &lt;h1 class=&quot;section-heading&quot; style=&quot;text-align: center;&quot;&gt;Login&lt;/h1&gt; &lt;!-- Text input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;email&quot;&gt;Email&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;email&quot; name=&quot;email&quot; type=&quot;email&quot; id = &quot;email&quot; placeholder=&quot;user@domain.com&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Password input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;password&quot;&gt;Password&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;********&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Button --&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;Submit&quot;&gt;&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;button id=&quot;submit&quot; name=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('message'); ?&gt; &lt;p class=&quot;text-muted&quot; style=&quot;text-align:center&quot;&gt;Don't have an account yet? Click &lt;a href=&quot;../register&quot;&gt;here&lt;/a&gt; to register.&lt;/p&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php echo $__env-&gt;make('auth.partials.master', array_except(get_defined_vars(), array('__data', '__path')))-&gt;render(); ?&gt;', '0') in Filesystem.php line 81
  at Filesystem-&gt;put('/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php', '&lt;?php $__env-&gt;startSection('title'); ?&gt; Admin Login &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('form'); ?&gt; &lt;form class=&quot;form-horizontal&quot; method=&quot;POST&quot; action = &quot;login&quot;&gt; &lt;?php echo e($error); ?&gt;&lt;?php /*TODO this doesn't show up now, when you do login make it show up*/ ?&gt; &lt;fieldset&gt; &lt;!-- Form Name --&gt; &lt;h1 class=&quot;section-heading&quot; style=&quot;text-align: center;&quot;&gt;Login&lt;/h1&gt; &lt;!-- Text input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;email&quot;&gt;Email&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;email&quot; name=&quot;email&quot; type=&quot;email&quot; id = &quot;email&quot; placeholder=&quot;user@domain.com&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Password input--&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;password&quot;&gt;Password&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;input id=&quot;password&quot; name=&quot;password&quot; type=&quot;password&quot; placeholder=&quot;********&quot; class=&quot;form-control input-md&quot; required=&quot;&quot;&gt; &lt;/div&gt; &lt;/div&gt; &lt;!-- Button --&gt; &lt;div class=&quot;form-group&quot;&gt; &lt;label class=&quot;col-md-4 control-label&quot; for=&quot;Submit&quot;&gt;&lt;/label&gt; &lt;div class=&quot;col-md-4&quot;&gt; &lt;button id=&quot;submit&quot; name=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Submit&lt;/button&gt; &lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php $__env-&gt;startSection('message'); ?&gt; &lt;p class=&quot;text-muted&quot; style=&quot;text-align:center&quot;&gt;Don't have an account yet? Click &lt;a href=&quot;../register&quot;&gt;here&lt;/a&gt; to register.&lt;/p&gt; &lt;?php $__env-&gt;stopSection(); ?&gt; &lt;?php echo $__env-&gt;make('auth.partials.master', array_except(get_defined_vars(), array('__data', '__path')))-&gt;render(); ?&gt;') in BladeCompiler.php line 102
  at BladeCompiler-&gt;compile('/srv/something/site/resources/views/auth/login.blade.php') in CompilerEngine.php line 51
  at CompilerEngine-&gt;get('/srv/something/site/resources/views/auth/login.blade.php', array('__env' =&gt; object(Factory), 'app' =&gt; object(Application), 'error' =&gt; '')) in View.php line 135
  at View-&gt;getContents() in View.php line 106
  at View-&gt;renderContents() in View.php line 80
  at View-&gt;render() in Response.php line 53
  at Response-&gt;setContent(object(View)) in Response.php line 197
  at Response-&gt;__construct(object(View)) in Router.php line 1030
  at Router-&gt;prepareResponse(object(Request), object(View)) in ControllerDispatcher.php line 95
  at ControllerDispatcher-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in ControllerDispatcher.php line 96
  at ControllerDispatcher-&gt;callWithinStack(object(authController), object(Route), object(Request), 'getAdminLogin') in ControllerDispatcher.php line 54
  at ControllerDispatcher-&gt;dispatch(object(Route), object(Request), 'App\Http\Controllers\authController', 'getAdminLogin') in Route.php line 174
  at Route-&gt;runController(object(Request)) in Route.php line 140
  at Route-&gt;run(object(Request)) in Router.php line 703
  at Router-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Router.php line 705
  at Router-&gt;runRouteWithinStack(object(Route), object(Request)) in Router.php line 678
  at Router-&gt;dispatchToRoute(object(Request)) in Router.php line 654
  at Router-&gt;dispatch(object(Request)) in Kernel.php line 246
  at Kernel-&gt;Illuminate\Foundation\Http\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
  at CheckForMaintenanceMode-&gt;handle(object(Request), object(Closure))
  at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
  at Pipeline-&gt;Illuminate\Pipeline\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
  at Pipeline-&gt;Illuminate\Routing\{closure}(object(Request))
  at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
  at Pipeline-&gt;then(object(Closure)) in Kernel.php line 132
  at Kernel-&gt;sendRequestThroughRouter(object(Request)) in Kernel.php line 99
  at Kernel-&gt;handle(object(Request)) in index.php line 54
  </code></pre>
  <p>So far, to try to fix this I've done the following:</p>
  <ol>
  <li>Checked permissions, changed everything to <code>777</code> and to be owned by <code>www-data</code></li>
  <li>Tried recloning the empty repository with no vendor file, to no avail, same error on composer install</li>
  <li>Ran <code>php artisan cache:clear</code></li>
  <li>Ran <code>php artisan clear-compiled</code></li>
  <li>Ran <code>php artisan dump-autoload</code></li>
  <li>Modified <code>site/config/view.php</code> on an <code>irc</code> suggestion, and changed  <code>compiled' =&gt; realpath(storage_path().'/framework/views')</code> to <code> 'compiled' =&gt; storage_path('framework/views'),</code> which yielded a different error: <code>file_put_contents(/srv/something/site/storage/framework/views/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.php): failed to open stream: No such file or directory</code> (probably because it's not supposed to be there, but who knows this information could be useful.)</li>
  </ol>
  <p>All of this to no avail.  The weird part is this issue seemingly showed up out of nowhere.  Thanks for the help!</p>