Env variables for plugins in PHP on Windows

I am running PHP on Windows. PHP plugins on Windows are just DLLs in a folder with extensions, and I can configure these plugins a bit.

For example, the ADAP plugin (which OpenLDAP itself) has parameters that I cannot change at runtime. Fortunately, OpenLDAP allows me to change some of these options while messing around with environment variables. I tried to configure them at runtime by adding both:

// this apparently works on Linux
putenv('VARIABLE=value');
// tried this one as well
$_ENV['VARIABLE'] = 'value';

But that did not work. I had to add this to my Windows environment variables (and it really worked), but this is too much pain in the rear and will break the code when I translate it. Is there a better way to do this, or will I deal with it?

thank

+3
1

dll. , dll php.ini, putenv(), dl(). DLL , .

.htaccess, SetEnv. , , - Apache. , apache_setenv(), mod_php, FastCGI.

Btw, PHP putenv, http://bugs.php.net/50690, .

0

Source: https://habr.com/ru/post/1752182/


All Articles