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
https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343439
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
https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343444
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
https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343462
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
https://forums.phpfreaks.com/topic/68302-auto-session_start/#findComment-343471
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.