Jump to content
Artur

PHP and $_ENV

Recommended Posts

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 ?

Share this post


Link to post

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...