What are the differences between setting session configurations in PHP using ini_set() versus directly in the php.ini file?

When setting session configurations in PHP, using ini_set() allows you to change the configuration settings for the current script only, while setting them directly in the php.ini file will affect all scripts on the server. This means that using ini_set() provides more flexibility and control over specific configurations for individual scripts, while editing the php.ini file will apply the changes globally.

// Setting session configurations using ini_set()
ini_set('session.cookie_lifetime', 3600); // Set cookie lifetime to 1 hour

// Setting session configurations in php.ini file
// session.cookie_lifetime = 3600