Laravel 5.2.11, sessions are not working, session cookie not being set
<p>I'm new to Laravel, I have learned about the models, views, blade, controllers and routes and how they work together. So far everything has been working smoothly.</p>

<p>I'm having trouble with sessions though.</p>

<p>When I use the AuthController that comes with Laravel and hit auth/register with a POST request, the data for the user that I register does get inserted into the users table (using mysql) and I do get back a response with the "Location" header redirecting to / like it does out of the box. It redirects like it should. But in the same response there is no "Set-Cookie" header set/sent. The session part of Laravel is not working properly for me. This is the same for a POST to auth/login, it authenticates properly and redirects to the profile page but no session cookie is sent back in the response.</p>

<p>I'm using:</p>

<ul>
<li>Laravel 5.2.11</li>
<li>PHP 5.5.9</li>
<li>xubuntu 14.04 (Ubuntu)</li>
<li>Linux kernel 3.19.0-42-generic</li>
<li>Composer 1.0</li>
</ul>

<p>All of the php modules that Laravel requires are installed. I'm running the app with php's built in web server. I run that with sudo. The exact command I run is this:</p>

<pre><code>sudo php -S localhost:8888 -t public/
</code></pre>

<p>All routes are being responded to properly.</p>

<p>I have tried both ways of installing Laravel that the installation docs recommend, through the laravel executable and composer create-project. Still no cookies set either way. I have made all the files and directories of the laravel project mod 777. The app key is set in .env if that makes any difference.</p>

<p>The config/session.php file is using the file driver for the session.
There are no session files in the storage/framework/sessions directory after setting a session.</p>

<p>When I try setting a session myself with the session function like it states in the docs:</p>

<pre><code>session(['sesskey' =&gt; 'somevalue']);
</code></pre>

<p>Again no "Set-Cookie" header is sent in the response and no session file is created. There are no error messages reported back either I should add.</p>

<p>When I do set a session key with the session function like above I can get that value back however and echo it back to the browser like so:</p>

<pre><code>echo session('sesskey');
</code></pre>

<p>So it does seem to save it at least in php's memory.</p>

<p>When I try setting a cookie using the withCookie method, I do get the proper response with the Set-Cookie header set:</p>

<pre><code>return response()-&gt;view('welcome')-&gt;withCookie(cookie("test", "val" , 3600));
</code></pre>

<p>I tried going down the illuminate rabbit hole to see if I could find a problem but that is a bit over my head atm.</p>

<p>Any help would be much appriciated, thanks!</p>