# Sa \*\*Topic/Title\*\*, ilagay mo: \*\*\`Does InfinityFree support PHP environment variables and private c

**URL:** <https://forum.infinityfree.com/t/sa-topic-title-ilagay-mo-does-infinityfree-support-php-environment-variables-and-private-c/121148>\
**Category:** Hosting Support\
**Created:** [October 8, 2026, 5:16am UTC](https://forum.infinityfree.com/t/sa-topic-title-ilagay-mo-does-infinityfree-support-php-environment-variables-and-private-c/121148 "2026-10-08T05:16:23Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Lemni](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/lemni/32/68303_2.png) [@Lemni](https://forum.infinityfree.com/u/Lemni)\
**Post date:** [October 8, 2026, 5:20am UTC](https://forum.infinityfree.com/t/sa-topic-title-ilagay-mo-does-infinityfree-support-php-environment-variables-and-private-c/121148/4 "2026-10-08T05:20:43Z")

</div>

_Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look._

I can’t confirm any of the three from what I found. Nothing in the knowledge base or the forum says whether PHP environment variables, a private config file outside `htdocs`, or `SetEnv` in `.htaccess` work on InfinityFree. I’d rather not guess on something that decides where your credentials live.

What I did find is a knowledge base article on installing Laravel. It says the web root is always the `htdocs` folder of your account and can’t be changed. It also says files in `htdocs` are reachable over the web unless you block them.

The article’s workaround is a rewrite rule in `htdocs/.htaccess`. Requests for sensitive files like `/.env` then return a 404 instead of the file:

> [@How to install a Laravel site on InfinityFree](https://forum.infinityfree.com/docs?topic=118578):
>
> Laravel is one of the most popular PHP frameworks, but it was not designed with regular shared web hosting in mind. Some parts of Laravel work out of the box on InfinityFree, some need a bit of configuration, and some features cannot be used at all. This article walks you through what to do, what to watch out for, and what you’ll need to work around. The document root problem When you install Laravel, you get a folder structure that looks roughly like this: my-laravel-app/ ├── app/ ├── bootstr…

That article is about Laravel, but the rewrite idea applies to any app that keeps its config inside `htdocs`. It doesn’t show that a location outside `htdocs` is usable, so it doesn’t answer your questions 1–3. If you keep secrets inside `htdocs`, check from a browser that the file actually returns a 404 and doesn’t show its contents.

You could settle the other two yourself with a quick test. Put a `SetEnv` line in `.htaccess` and read it with `getenv()` in a small PHP file. Or look at your FTP client’s folder tree to see whether you can create a folder next to `htdocs`. That would only tell you what works on your account. It wouldn’t be a documented guarantee.

---

_[View the full topic](https://forum.infinityfree.com/t/sa-topic-title-ilagay-mo-does-infinityfree-support-php-environment-variables-and-private-c/121148)._
