I was playing around with php.ini’s session.start_auto and tried setting it to 1. The site I am building requires session management on every page anyways and the server only contains the one site. Is this considered bad practice (like having globals turned on – which I dont BTW!) – php.net doesn’t say a lot about it.
I was playing around with php.ini’s session.start_auto and tried setting it to 1. The
Share
IMO relying on
php.inisettings can be tricky if people deploying your app don’t have control on thephp.ini(e.g. shared hosting). And even if thephp.inican be changed, understanding a problem due to aphp.iniconfiguration problem may be difficult to understand (you may have to write a script allowing to check if config is Ok, etc.).As an alternative, you can create a unique “controller” script (e.g.
/index.php), which will call and output different pages depending on parameters sent to it (e.g.yoursite.com/index.php?page=12or even betteryoursite.com/page/12with routing & URL rewriting). And in that index.php file, put yoursession_start()once for all pages.