Hello!

I know the putenv() function used to set an environment variable (before doing a system() call, for example).

I'm searching a simple way to set the HOME variable at system level, to avoid editing every single .php file of an existing large project (the software is pmapper).

Playing with Apache and php.ini did not gave any clues, the only trick that worked was adding something like this in the Apache configuration file:

php_admin_value auto_prepend_file /var/www/env.php

and then setting the relevant puntenv() function in the prepended file. Is this the right way to do it?

    You can also use "php_value" in a .htaccess file (if PHP is running as an Apache module).

    As for permanently setting the system variable... well, I'm no Unix guru, so I can't remember the method of doing that.

      Write a Reply...