Jump to content

Auto session_start();


cooldude832

Recommended Posts

Is there a way without code <?php session_start();?> ontop of each page to get that affect?

 

Yes. See the session.auto_start directive within your php.ini

 

Is there a way to setup in .htaccess a script to run on everypage.

 

.htaccess is parsed upon every request to the directory containing the .htaccess file.

 

Then how do all my site statistics work because they track stats on each page being hit, unless apache returns that data somehow.

 

Most stat programs query the Apache logs.

Link to comment
Share on other sites

Is that an issue, if everyone who visits the site will need sessions to do anything, setting it to auto start that is.

 

That depends on your site.  If you have a lot of traffic on pages that don't use sessions, then you're probably better off starting them explicitly on those pages which do need them.

Link to comment
Share on other sites

so like

<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

That technically isn't compliance because it be in the prolouge of the file

or

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php sesion_start(); ?>
//Declare some headers via <html lang="en"> or some other method
?>

that does work but i have gotten header's already sent errors with this

Link to comment
Share on other sites

I've gotten errors using the upload a file version not the insert a url on the validator on w3 (I assume you are familiar with it).  I'm sure they address this issue in the consornoium and declare that scripting of anything preprocessor can exist pre the doc type as long as it doesn't produce any output.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.