How can PHP developers ensure the secure transmission of session IDs, especially when working with shared hosting providers?

PHP developers can ensure the secure transmission of session IDs by setting the session.cookie_secure option to true in their PHP configuration. This will ensure that session cookies are only sent over secure HTTPS connections. Additionally, developers should also set the session.cookie_httponly option to true to prevent session cookies from being accessed by JavaScript.

// Set session.cookie_secure and session.cookie_httponly options
ini_set('session.cookie_secure', 1);
ini_set('session.cookie_httponly', 1);

// Start the session
session_start();