$_SESSION variables work perfectly on my local machine but returns NULL on development webserver

WordPress does not use $_SESSION variables, and neither should you.

Sessions variables come with a lot of issues:

  • they’re fundamentally incompatible with page caching plugins
  • they’re incompatible with systems such as Cloudflare
  • WordPress uses cookies to track sessions
  • a lot of WP hosts are not set up to work with PHP sessions variables, e.g. WP Engine

If your goal is to show a splash screen the first time people visit your site, you don’t need PHP session variables, there are much better/simpler/easier ways to do it.

For example:

  • Cookies!! This is probably your best bet, and can be set via javascript too
  • Using Javascript, and relying on a local storage mechanism
  • There may even be a CSS based solution using the :visited pseudo selector, e.g. .modal_link:visited * { display: none; visibility: hidden; } where modal_link is a class name on a hyperlink to your homepage
  • not showing a splash screen as it’s awful UX and incredibly annoying to your sites visitors, and if you accidentally dismiss it, you need intermediate to advanced developer skills to bring it back. Research shows numerous disadvantages, etc, etc, etc

The last option would provide the best user experience.

As for your local machine, MAMP etc can’t make too many guesses about what it’s being used with, unlike a WP managed host. It’s also extremely unlikely a CDN has been inserted between you and MAMP. Any page caching is probably disabled for logged in users as well. That doesn’t mean what works in MAMP should work everywhere, just that what works in MAMP will work in MAMP