I wasted at least a day on this.
Modifying values in the script via ini_set looks like it works when you output information via phpinfo but the php session was still lost after 30 minutes of inactivity.
You need to modify the godaddy php.ini file to get this working
The values you need to set are described in StackOverflow: How do I expire a PHP session after 30 minutes?
What it doesn’t discuss is that in a shared hosting environment your php.ini might be incorrectly set to /tmp and other PHP instances might be running with garbage collection and deleting your files, or some other rogue process is deleting files. GoDaddy’s documentation says files are deleted after 7 days in /tmp.
You need to change session.save_path to something within your control, e.g:
session.save_path=/home//tmp
Step 0.
Have a debug page with a call to phpinfo() in it, you might also want to debug $_SESSION variables as well.
I also dump out some other useful debug information into that debug table:
<tr>
<td class="e">session_save_path
</td>
<td class="v">
<?=session_save_path()?>
</td>
</tr>
<tr>
<td class="e">session.auto_start
</td>
<td class="v">
<?=ini_get('session.auto_start')?>
</td>
</tr>
<tr>
<td class="e">session.gc_maxlifetime
</td>
<td class="v">
<?=ini_get('session.gc_maxlifetime')?>
</td>
</tr>
<tr>
<td class="e">session.gc_probability
</td>
<td class="v">
<?=ini_get('session.gc_probability')?>
</td>
</tr>
<tr>
<td class="e">session.gc_divisor
</td>
<td class="v">
<?=ini_get('session.gc_divisor')?>
</td>
</tr>
<tr>
<td class="e">memory_limit
</td>
<td class="v">
<?=ini_get('memory_limit')?>
</td>
</tr>
<tr>
<td class="e">session.cookie_lifetime
</td>
<td class="v">
<?=ini_get('session.cookie_lifetime')?>
</td>
</tr>
Step 1.
Check where the php.ini file should go., I will not describe how to determine which service type you have, just try every location if you can’t figure it out.
Note: the Loaded Configuration File and Additional .ini files parsed values that phpinfo() show before you provide your own php.ini are not the locations where you should be uploading the file.
Step 2.
Rerun you script from Step 0. and see if the session.gc_maxlifetime has changed.
Trouble Shooting
After making the change and reading the php.ini/.user.ini Changes Not Taking Effect documentation - it was still not working.
This was the point where I rang support who told me for the cPanel version needed to be in /public_html, and to prove them wrong I reloaded my Step 0. file - and the values were now updated.
So I expect that you may need to wait 5 to 10 minutes before the changes take effect.