Artur Posted January 24, 2013 Share Posted January 24, 2013 Hi, 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
jdfwarrior Posted January 24, 2013 Share Posted January 24, 2013 Instead of trying to read $_ENV I just always do $var = exec('printf $HOME'); Have you tried that? Link to comment
bigluck Posted January 25, 2013 Share Posted January 25, 2013 You can also use $_SERVER['HOME'] Link to comment
jdfwarrior Posted January 25, 2013 Share Posted January 25, 2013 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.. <?php $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
Artur Posted January 27, 2013 Author Share Posted January 27, 2013 That works indeed. Thanks. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now