Yes it will. You could however use
ini_set('session.cookie_domain', '.' . $_SERVER['SERVER_NAME']); and that looks like it should work. Cookies only have a meaning in an application that can use them, so this won't work on the CLI since $_SERVER won't be available, but its irrelevant since CLI cannot use cookie normally with session_start or setcookie; that would require the use of curl or another method to handle anyway.
Edit:
Perhaps a better approach would be to use a defined constant in a configuration script. This can be changed between the development and production using define('_MY_SITE', '.localhost') and define('_MY_SITE', '.site.com');. Then just use _MY_SITE in the ini_set.