title: PHP sessions: $_SESSION is empty running locally on Mac
body: <p>I know there are similar other questions here, but none of them solved my problem.</p>
  <p><strong>The problem:</strong> I'm setting data into $_SESSION, but in upcoming calls it is appearing as empty.</p>
  <p><strong>What I did to try solving it?</strong></p>
  <ol>
  <li>Make sure to run an up-to-date version of PHP</li>
  <li>Make sure to know which php.ini is used</li>
  <li>Log status of $_SESSION before and after setting it</li>
  <li>Set various variables as suggested in other questions and forums</li>
  </ol>
  <p>Here below I provide all the info I could supply, and hoping somebody will be able to suggest a solution!</p>
  <hr />
  <p>I have installed PHP on my Mac using <code>brew install php</code></p>
  <p>I am running it locally for software development using this command:</p>
  <pre><code>php -S localhost:8099 -d display_errors=on -t .
  [Tue Nov 17 23:12:55 2020] PHP 7.4.11 Development Server (http://localhost:8099) started
  </code></pre>
  <p>I'm calling <code>session_start();</code> at the beginning of my script.
  I am setting values into $_SESSION, but it is always empty when I am testing it in the following calls:</p>
  <pre><code>$ses = json_encode($_SESSION);
  site_log(&quot;before: {$ses}&quot;);
  
  session_regenerate_id();
  $_SESSION[&quot;upath&quot;] = 'XXXXXX';
  
  $ses = json_encode($_SESSION);
  site_log(&quot;after: {$ses}&quot;);
  </code></pre>
  <p>The result is always the same (while I'm expecting to see it on first call but not for the following calls):</p>
  <pre><code>20201118_040124_484 before: []
  20201118_040124_485 after: {&quot;upath&quot;:&quot;XXXXXX&quot;}
  </code></pre>
  <p>I was trying to follow many ideas from web forums:</p>
  <p>Verify which is the INI file:</p>
  <pre><code>php -i | grep 'Configuration File'
  &gt;Configuration File (php.ini) Path =&gt; /usr/local/etc/php/7.4
  &gt;Loaded Configuration File =&gt; /usr/local/etc/php/7.4/php.ini
  </code></pre>
  <p>I was setting various INI file variables:</p>
  <pre><code>session.save_path = &quot;/Users/myuser/Prog/MyApp/sessions&quot;
  +
  chmod 777 /Users/myuser/Prog/MyApp/sessions
  +
  session.use_cookies = 1
  +
  session.cookie_secure = 0
  </code></pre>
  <p>But the result is still the same. Any idea please?</p>
  <p>The following link points to the result of calling phpinfo(): <a href="https://vedibarta.org/session-info.txt" rel="nofollow noreferrer">link</a></p>