views:

552

answers:

2

Rather than hard-wiring some paths in my php.ini configuration, I'd like to configure them using system variables that are shared in some other places such as my Apache configuration. I've done some searching and couldn't find the right mix of keywords to discover if there's a way to do this.

Does anyone know if this can be done?

upload_tmp_dir = $SCRATCH_HOME/uploads

Now SCRATCH_HOME can be exported in the environment as /tmp or /var/scratch or whatever I want it to be.

+1  A: 

No, this is not possible. But you can use get_env() to set certain options from within your script. The list of changeable ini directives can be obtained here (Anything that has a CHANGEABLE value of PHP_INI_ALL or PHP_INI_USER). Unfortunately it does not work for upload_tmp_dir.

soulmerge
+1  A: 

Try configuring PHP via Apache config files:

PHP_admin_value upload_tmp_dir $SCRATCH_HOME/uploads

Works fine for me. (psst, you cannot change upload_tmp_dir using .htaccess)

Maciej Łebkowski