The following code should work on all php setups.
The following code needs to be entered on the file/thread you want the variables to be altered for. This code will on temporarily alter the enviromental variables and they will revert to what they were after the file has finished running. There is also some additional code to display the php info so you can see the variables have been altered, this section can be deleted.
<? $phptemp = "/var/www/vhosts/example.com/httpdocs/php.ini"; putenv("PHPRC=$phptemp"); /* the one below works */ apache_setenv("PHPRC", $phptemp); $yo = getenv('PHPRC'); echo $yo; phpinfo(); ?>