vmitchell85

What are you doing when you get the error?

afonte15

When I originally got the error I tried changing the permissions to the storage and boostrap/cache folder

vmitchell85

The stack overflow thing you posted is irrelevant. You're developing on a dev machine so you generally don't need to work about permissions right now. When you deploy your code online then you'll need correct permissions. Having 777 right now is fine.

I want to know exactly what you are doing to get the error. Are you running a command on the vagrant box? Are you trying to load a url in the browser? What exactly are you doing to make the error show up?

afonte15

I am at the login page and I provide the credentials to login and it just redirects back to the login page. Password is correct and then I check my laravel.log file and I get that permission error.

vmitchell85

Can you post the full error please

afonte15

[2017-04-19 01:31:38] local.ERROR: ErrorException: file_put_contents(/home/vagrant/sites/inventory/storage/framework/sessions/ff658e4153dbe2a47c29e631e8d583919f9cd549): failed to open stream: Permission denied in /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:111
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/home/vagrant/s...', 111, Array)
#1 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(111): file_put_contents('/home/vagrant/s...', 'a:4:{s:6:"_toke...', 2)
#2 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(83): Illuminate\Filesystem\Filesystem->put('/home/vagrant/s...', 'a:4:{s:6:"_toke...', true)
#3 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Store.php(262): Illuminate\Session\FileSessionHandler->write('ff658e4153dbe2a...', 'a:4:{s:6:"_toke...')
#4 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(88): Illuminate\Session\Store->save()
#5 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(155): Illuminate\Session\Middleware\StartSession->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\RedirectResponse))
#6 /home/vagrant/sites/inventory/public/index.php(48): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\RedirectResponse))
#7 {main}  
[2017-04-19 01:31:38] local.ERROR: ErrorException: file_put_contents(/home/vagrant/sites/inventory/storage/framework/sessions/21c72020b901982cd900a79aef6151ea0cd9ed72): failed to open stream: Permission denied in /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:111
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/home/vagrant/s...', 111, Array)
#1 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(111): file_put_contents('/home/vagrant/s...', 'a:5:{s:6:"_toke...', 2)
#2 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(83): Illuminate\Filesystem\Filesystem->put('/home/vagrant/s...', 'a:5:{s:6:"_toke...', true)
#3 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Store.php(262): Illuminate\Session\FileSessionHandler->write('21c72020b901982...', 'a:5:{s:6:"_toke...')
#4 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(88): Illuminate\Session\Store->save()
#5 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(155): Illuminate\Session\Middleware\StartSession->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\RedirectResponse))
#6 /home/vagrant/sites/inventory/public/index.php(48): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\RedirectResponse))
#7 {main}  
[2017-04-19 01:31:38] local.ERROR: ErrorException: file_put_contents(/home/vagrant/sites/inventory/storage/framework/sessions/f0d71b09248682b4a9688510fcd4c3001e20682a): failed to open stream: Permission denied in /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:111
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'file_put_conten...', '/home/vagrant/s...', 111, Array)
#1 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(111): file_put_contents('/home/vagrant/s...', 'a:5:{s:6:"_toke...', 2)
#2 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(83): Illuminate\Filesystem\Filesystem->put('/home/vagrant/s...', 'a:5:{s:6:"_toke...', true)
#3 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Store.php(262): Illuminate\Session\FileSessionHandler->write('f0d71b09248682b...', 'a:5:{s:6:"_toke...')
#4 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(88): Illuminate\Session\Store->save()
#5 /home/vagrant/sites/inventory/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(155): Illuminate\Session\Middleware\StartSession->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#6 /home/vagrant/sites/inventory/public/index.php(48): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
#7 {main}  
vmitchell85

does the /home/vagrant/sites/inventory/storage/framework/sessions/ folder exist? what are the permissions on that folder if it does exist

afonte15

[email protected]:~/sites/inventory/storage$ ls -l total 12

drwxr-xrwx 1 vagrant vagrant 4096 Mar  2 21:55 app
drwxr-xrwx 1 vagrant vagrant 4096 Mar  2 21:55 framework
drwxr-xrwx 1 vagrant vagrant 4096 Apr 18 02:04 logs
[email protected]:~/sites/inventory/storage$ cd framework
[email protected]:~/sites/inventory/storage/framework$ ls -l
total 12
drwxrwxrwx 1 vagrant vagrant 4096 Mar 10 20:55 cache
drwxrwxrwx 1 vagrant vagrant 4096 Apr 19 01:31 sessions
drwxrwxrwx 1 vagrant vagrant 4096 Apr 19 01:31 views
[email protected]:~/sites/inventory/storage/framework$ cd sessions
[email protected]:~/sites/inventory/storage/framework/sessions$ ls -l
total 20
-rw-r--r-- 1 vagrant vagrant 197 Apr 19 01:30 074589b8bef8732a3a55eaca60ceaa9e2adb4610
-rw-r--r-- 1 vagrant vagrant 360 Apr 19 01:31 21c72020b901982cd900a79aef6151ea0cd9ed72
-rw-r--r-- 1 vagrant vagrant 268 Apr 19 01:31 236b18b7007d091ef48d2d863627e545286c39e1
-rw-r--r-- 1 vagrant vagrant 349 Apr 19 01:31 f0d71b09248682b4a9688510fcd4c3001e20682a
-rw-r--r-- 1 vagrant vagrant 268 Apr 19 01:31 ff658e4153dbe2a47c29e631e8d583919f9cd549
[email protected]:~/sites/inventory/storage/framework/sessions$ 
vmitchell85

I'm out of ideas... If you can I would suggest destroying the vagrant box, downloading the latest Homestead again.

Sorry I couldn't be of more assistance.

afonte15

I run into this error when i have

class InventoriesController extends Controller
{
   public function __construct()
    {
        $this->middleware('auth');  
    }

But if I uncomment

class InventoriesController extends Controller
{
   public function __construct()
    {
        //$this->middleware('auth');  //does not allow users to login, redirects back to login when using LDAP credentials

    }

I am able to login and I receive no errors but then I am able to access the other web url without being logged in.

Any thoughts?

vmitchell85

It seems you're using file based sessions and auth requires the session files. Since you cannot access the files for some reason that is why commenting that out works, since you don't need auth anymore for those routes.

afonte15

Can I ask you one more question. I am setting up my development machine again.

Setting up vagrant/homestead

I ran bash init.sh and it said homestead initialized but when I try to navigate to the .homestead folder I get bash: cd: .homestead: No such file or directory

I am on Ubuntu 16.04

vmitchell85

Sorry, no idea

Sign In or create a forum account to participate in this discussion.