What are the potential pitfalls of storing sessions as cookies in PHP?

Storing sessions as cookies in PHP can lead to security vulnerabilities such as session hijacking or session fixation. To mitigate these risks, it is recommended to store session data on the server side instead of relying solely on cookies.

// Store session data on the server side
ini_set('session.save_handler', 'files');
session_start();