How can the disabling of cookies in a browser affect the functionality of PHP sessions?

Disabling cookies in a browser can affect the functionality of PHP sessions because by default, PHP uses cookies to store session IDs. If cookies are disabled, PHP will not be able to store the session ID and therefore will not be able to maintain the session state between page requests. To solve this issue, you can configure PHP to use URL rewriting to pass the session ID in the URL instead of using cookies.

<?php
// Start the session
session_start();

// Check if the session ID is passed in the URL
if(isset($_GET['PHPSESSID'])){
    session_id($_GET['PHPSESSID']);
}

// Rest of your PHP code here
?>