# How to set Permanent Session for Token in Dreamfactory 2.2.0?

**URL:** <https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979>\
**Category:** Authentication & Security\
**Tags:** community\
**Created:** [July 12, 2016, 11:51am UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979 "2016-07-12T11:51:20Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![aamir\_rais](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@aamir\_rais](https://community.dreamfactory.com/u/aamir_rais)\
**Post date:** [July 12, 2016, 11:51am UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/1 "2016-07-12T11:51:20Z")

</div>

I am building Rest Api and made changes in df.php file by setting

```
'allow_forever_sessions' => env('DF_ALLOW_FOREVER_SESSIONS', true) 

```

and also use “remember\_me”:true in code for eg.  
{  
“id” : 5,  
“email” : "Zxy@example.com",  
“password” : “Zxy”,  
“remember\_me”:true

}  
But, still facing token expiration issues. I want to make token life forever.  
What can I do to make it alive ?.  
Need help.

Thanks.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [July 15, 2016, 5:28pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/2 "2016-07-15T17:28:35Z")

</div>

I would recommend against changing df.php  
System settings should be changed in the .env file  
See [https://wiki.dreamfactory.com/DreamFactory/Tutorials/Forever\_sessions](https://wiki.dreamfactory.com/DreamFactory/Tutorials/Forever_sessions)

After you make those changes, you may need to clear a cached configuration.

Backup the file bootstrap/cache/config.php; save it somewhere in case clearing the config cache causes problems.  
Then run `php artisan config:clear`

---

<div class="post-metadata">

**Author:** ![aamir\_rais](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@aamir\_rais](https://community.dreamfactory.com/u/aamir_rais)\
**Post date:** [July 19, 2016, 11:34am UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/3 "2016-07-19T11:34:35Z")

</div>

I made changes in df.php file but didn’t find .env file anywhere.  
I am working on Dreamfactory-2.2.0.

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [July 20, 2016, 5:48pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/4 "2016-07-20T17:48:15Z")

</div>

If this is a Bitnami install it will be in the htdocs folder.  
For example, on Windows, this would default to `C:\Bitnami\dreamfactory-2.2.0-0\apps\dreamfactory\htdocs\.env`

Since the filename starts with a . it is likely hidden in your file browser. You will need to show hidden files to see it.

---

<div class="post-metadata">

**Author:** ![bhavin4538](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bhavin4538](https://community.dreamfactory.com/u/bhavin4538)\
**Post date:** [October 31, 2017, 12:40pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/5 "2017-10-31T12:40:07Z")

</div>

But where .env file is located ?

---

<div class="post-metadata">

**Author:** ![formerstaff](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/formerstaff/32/1133_2.png) [@formerstaff](https://community.dreamfactory.com/u/formerstaff)\
**Post date:** [November 1, 2017, 1:17pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/6 "2017-11-01T13:17:51Z")

</div>

See the post right above yours

---

<div class="post-metadata">

**Author:** ![bhavin4538](https://avatars.discourse-cdn.com/v4/letter/b/94ad74/32.png) [@bhavin4538](https://community.dreamfactory.com/u/bhavin4538)\
**Post date:** [November 3, 2017, 4:52am UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/7 "2017-11-03T04:52:12Z")

</div>

I tried all the 3 steps that you have mentioned in the post but i am getting

```auto
"allow_forever_sessions:false" after calling GET:[http://127.0.0.1:81/api/v2/system/environment](http://127.0.0.1:81/api/v2/system/environment).

```

I am using Dreamfactory 2.9.0. Is that any issue with this version?

Please give me some help.

---

<div class="post-metadata">

**Author:** ![Shivamurugan](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@Shivamurugan](https://community.dreamfactory.com/u/Shivamurugan)\
**Post date:** [March 31, 2018, 7:46am UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/8 "2018-03-31T07:46:40Z")

</div>

while running `php artisan config:clear` i’m facing this error  
seyali-01@seyali-01:~/dreamfactory-2.12.0-0$ php artisan config:clear  
The program ‘php’ can be found in the following packages:  
\* php7.0-cli  
\* hhvm  
Try: sudo apt install   
For this error as per the documentation i have to specify the full path of php but how to find the full path of php please help me over this.

---

<div class="post-metadata">

**Author:** ![Erik\_Jacobsen](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/erik_jacobsen/32/1132_2.png) [@Erik\_Jacobsen](https://community.dreamfactory.com/u/Erik_Jacobsen)\
**Post date:** [April 19, 2018, 5:08pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/9 "2018-04-19T17:08:44Z")

</div>

@bhavin4538 Did you find your .env file? You want to uncomment (remove the # signs) in front of this line and change the value to true:

[![CloudApp](https://dzwonsemrish7.cloudfront.net/items/3b0S2G1W0j310f3T1908/%5B0e4e3493c16525b07e061e507b3dbe17%5D_Image%25202018-04-19%2520at%252010.06.18%2520AM.png "Image 2018-04-19 at 10.06.18 AM.png") ](https://cl.ly/2X0F1o1U1Q2G)

You should then be able to re-run the GET request you tried and see the default changed to true.

---

<div class="post-metadata">

**Author:** ![Erik\_Jacobsen](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.dreamfactory.com/erik_jacobsen/32/1132_2.png) [@Erik\_Jacobsen](https://community.dreamfactory.com/u/Erik_Jacobsen)\
**Post date:** [April 19, 2018, 5:12pm UTC](https://community.dreamfactory.com/t/how-to-set-permanent-session-for-token-in-dreamfactory-2-2-0/2979/10 "2018-04-19T17:12:12Z")

</div>

@Shivamurugan what install environment are you on?

Are you on a certain install step, or upgrade step? Is there another issue related to the `php artisan config:clear` command you typed?

Most times you can find the php path with the follow commands:

`which php`

[![CloudApp](https://dzwonsemrish7.cloudfront.net/items/0r0w1U3O2k292e321F1F/Image%202018-04-19%20at%2010.10.17%20AM.png "Image 2018-04-19 at 10.10.17 AM.png") ](https://cl.ly/2M1C091Z1T0w)
