Set environment variables

How to set up environment variables for php in infinity free.

This is not allowed on this host and won’t be.

1 Like

Why do you need to setup environment variables?

The short answer is that you can’t setup actual environment variables, but maybe there are ways to achieve the same results in another way?

3 Likes

I need to store my API keys and other stuff so that my website doesn’t show those explicitly the users.

So… how do you suppose environment variables will help with that? Where and how would you expect to set these environment variables to make sure they are protected?

The common way for PHP websites to store configuration safely is to have a PHP script which defines them as variables or constants. So you create a file config.php which has these variables. Your other scripts can then include this configuration file to access the configuration, but people who try to access it directly will just see a blank page (because defining variables does not produce any visible output).

2 Likes

Yeah. I think that would solve the issue.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.