-
I'm trying to incorporate envkey-php into my WordPress theme by functions.php, however I'm getting the error Same thing if I try to load it from index.php or wp-config.php in the WordPress root I have no problem loading other composer packages, like dotenv (not at the same time though) which is what we're trying to migrate from. I'm running, under MAMP on mac: The thing is, if I run If I load envkey-php from composer in my localhost site (nothing else but phpinfo()), everything works as expected as well. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 7 replies
-
Hey @nikalas, thanks for providing details on this.
When you say you can run this successfully, are you running it from the shell or directly within your php app? Where are you setting your |
Beta Was this translation helpful? Give feedback.
-
To test an idea on this, could you try adding the following prior to pulling in the
|
Beta Was this translation helpful? Give feedback.
-
Seems the problem is running PHP under Apaches Virtual Host (With FastCGI?) which runs sandboxed. As you say the env's are not exposed to the php service because of this. Which I guess is actually in the ENVKEY documentation. Also nothing to do with WordPress per se. So the solution here seems to be to, if I understand it correctly:
Thank you for you help! |
Beta Was this translation helpful? Give feedback.
Seems the problem is running PHP under Apaches Virtual Host (With FastCGI?) which runs sandboxed. As you say the env's are not exposed to the php service because of this. Which I guess is actually in the ENVKEY documentation. Also nothing to do with WordPress per se.
So the solution here seems to be to, if I understand it correctly:
SetEnv ENVKEY <local-key-here>
require_once 'vendor/autoload.php'
(I still don't see why this is needed as I cangetenv('ENVKEY')
and get the local key earlier, but it does not work without it.)Thank you for you help!