Skip to main content
4 of 5
edited tags
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Using Drupal's session inside a PHP script

I need to pass parameters from a Drupal page to a PHP script. There's no way to pass that directly and I need to use SESSIONS. I've searched around and added this at the top of the script:

define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_SESSION);

With that I can use Drupal's session but I'm getting this error:

Warning: session_start(): Cannot send session cache limiter - headers already sent

It's not so bad since it's just a warning and I can use CSS to make it not visible to the user. But I was wondering if there is a cleaner way to do so.

doron
  • 427
  • 1
  • 6
  • 14