Jump to content

PHP and $_ENV

Recommended Posts



I'm writing a workflow with PHP filter scripts and I'm trying to use $_ENV but it doesn't seem to work:


$supernova_cfg = parse_ini_file($_ENV["HOME"]."/.supernova", true);


this will work as expected when I run it form command line but it'll fail when executed by Alfred action. Am I doing something wrong ?

Link to comment

I just checked this code on an random iMac in the Apple Store to make sure it wasn't something special I had done to get it work..



$var = exec('printf $HOME');
echo $var;


That DEFINITELY works. In your example if you put the printf $HOME portion in double quotes that will mess things up btw. By doing that, it will look at $HOME as a php variable instead of system variable. Take the code above and copy and paste it into a new php file and then run:


php -f <file>.php 


That will run the file from the command line. That should 100% work.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...