Warning: session_start (): Setting option 'auto_start' failed

1

I get the following error on line 10: Warning: session_start (): Setting option 'auto_start' failed

session_start([
    'use_only_cookies' => 1,
    'auto_start' => 1,
    'read_and_close' => true
]);

That corresponds to 'auto_start' = > 1, check the PHP documentation and the directive is well written.

link

I am using PHP 7.0.10.

    
asked by Nilton Venegas 20.08.2017 в 20:19
source

2 answers

2

Notice that in the table Session configuration options

You have the following:

Nombre               | Por defecto    | Cambiable
--------------------------------------------------------
session.auto_start   | "0"            |  PHP_INI_PERDIR 

If you check the Changeable value ( PHP_INI_PERDIR ), you'll see that can not be modified at runtime:

Modo            | Significado
----------------------------------
PHP_INI_USER    | La entrada se puede establecer en scripts de usuario (como con ini_set()) o en el registro de Windows. Desde PHP 5.3, la entrada puede ser establecida en .user.ini
PHP_INI_PERDIR  | La entrada se puede establecer en php.ini, .htaccess, httpd.conf o .user.ini (desde PHP 5.3)
PHP_INI_SYSTEM  | La entrada se puede establecer en php.ini o en httpd.conf
PHP_INI_ALL     | La entrada se puede establecer en cualquier lugar

So that particular directive can only be modified in php.ini, .htaccess, httpd.conf or .user.ini .

Likewise, it would not make any sense to do what you want, because it would not make sense (at run time) to tell PHP to auto login at the same time you log in.

    
answered by 21.08.2017 / 00:05
source
0

Hello to enable the auto_start if you are using xampp go to the panel in configuration and open the php.ini, then look for auto_start and in the 0 parameter change it to 1 with it will remain active if you will then upload the application to a server you should be sure that you can modify it directly in the php.ini so that it is enabled therefore you do not need in the session_start of your fix to include it xq it will be active it would be this way, I solve it in that way .. =)

session_start([
'use_only_cookies' => 1,
'read_and_close' => true

]);

    
answered by 12.10.2018 в 21:22