# Timeout using PHP Library and Lock

**URL:** <https://community.auth0.com/t/timeout-using-php-library-and-lock/7309>\
**Category:** Get Help\
**Tags:** php, timeout-error, timeout, lock\
**Created:** [June 28, 2017, 10:58pm UTC](https://community.auth0.com/t/timeout-using-php-library-and-lock/7309 "2017-06-28T22:58:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yannick](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yannick/32/7774_2.png) [@yannick](https://community.auth0.com/u/yannick)\
**Post date:** [June 28, 2017, 10:58pm UTC](https://community.auth0.com/t/timeout-using-php-library-and-lock/7309/1 "2017-06-28T22:58:35Z")

</div>

I’ve been using Lock for quite some time now, along with the PHP SDK and it has been reported that there is an issue with users being logged out after less than 30 minutes regardless of the session timeout being set to 36,000 seconds.

Is there anywhere else that timeouts are set that could be causing this?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [July 5, 2017, 5:00pm UTC](https://community.auth0.com/t/timeout-using-php-library-and-lock/7309/2 "2017-07-05T17:00:14Z")

</div>

To my knowledge the SDK just delegates to the session store you want to use (PHP session is the default) so the issue should not be related to the SDK itself as I could not find any possibly logic at the SDK level that could impact the expiration you configured.

Given this highly depends on how you configured your application you may want to update the question with more information.

---

<div class="post-metadata">

**Author:** ![barrie.treloar](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/barrie.treloar/32/7660_2.png) [@barrie.treloar](https://community.auth0.com/u/barrie.treloar)\
**Post date:** [February 14, 2018, 5:29pm UTC](https://community.auth0.com/t/timeout-using-php-library-and-lock/7309/3 "2018-02-14T17:29:33Z")

</div>

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?](https://stackoverflow.com/questions/520237/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](http://php.net/manual/en/function.phpinfo.php#109856) 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.](https://au.godaddy.com/help/what-filename-does-my-php-initialization-file-need-to-use-8913), 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](https://au.godaddy.com/help/phpiniuserini-changes-not-taking-effect-5647) 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.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:55am UTC](https://community.auth0.com/t/timeout-using-php-library-and-lock/7309/4 "2018-03-02T05:55:02Z")

</div>


