I’m a newbie to .htaccess and came across a a line that I think needs to be in the htaccess file. That lines reads “php_value session.auto_start 1.” If I understand correctly this is all I need to do for all the files in the directory where htaccess is located. Currently every files contains the code below.
<?php
session_start();
$admin_id= $_SESSION["admin_id"];
$administrator = $_SESSION["administrator"];
$role= $_SESSION["role"];
$sub_role= $_SESSION["sub_role"];
if($role == 'webmaster') {$role ='admin';}
?>
Do I need the session_start() in those files? Do I have a correct understanding?
1
Create or open a .htaccess file in the root of your directory where you want this setting to apply.
Add the following line to the .htaccess file.
php_value session.auto_start 1
Faisal Hanif is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.