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.
In instances where I've had to do things like this I've done the following. It's worked for D6/D7 without any warnings for me. 

  $current_path = getcwd(); //Current app path

  //Remove any HTTP headers/output
  header_remove();
  ob_clean();

  //Bootstrap Drupal w/ dir change 
  //$drupal_root being the root Drupal install path
  define('DRUPAL_ROOT', $drupal_root);
  chdir($drupal_root);
  require_once "$drupal_root/includes/bootstrap.inc";

  /*Execute Code Dependant on Drupal Environment */

  chdir($current_path); //Return to existing app path