PHP sessions support

PUBLISHED ON MAY 8, 2020 — CODE, HOW-TO, PHP

Recently I was working with a few wordpress websites and wp engine, some of these websites were using plugins working with php sessions and I wasn’t aware that wp engine does not like sessions

Anyway, I found a snippet to test it out:

<?
// Start Session
session_start();
// Show banner
echo '<b>Session Support Checker</b><hr />';
// Check if the page has been reloaded
if(!isset($_GET['reload']) OR $_GET['reload'] != 'true') {
   // Set the message
   $_SESSION['MESSAGE'] = 'Session support enabled!<br />';
   // Give user link to check
   echo '<a href="?reload=true">Click HERE</a> to check for PHP Session Support.<br />';
} else {
   // Check if the message has been carried on in the reload
   if(isset($_SESSION['MESSAGE'])) {
      echo $_SESSION['MESSAGE'];
   } else {
      echo 'Sorry, it appears session support is not enabled, or you PHP version is to old. <a href="?reload=false">Click HERE</a> to go back.<br />';
   }
}
?>

Sadly but true, they don’t like sessions.

TAGS: PHP, SESSIONS, SUPPORT
comments powered by Disqus