  We use a 0.040 < z < 0.085 sample of 37866 star-forming galaxies from the
Fourth Data Release of the Sloan Digital Sky Survey to investigate the
dependence of gas-phase chemical properties on stellar mass and environment.
The local density, determined from the projected distances to the fourth and
fifth nearest neighbours, is used as an environment indicator. Considering
environments ranging from voids, i.e., log Sigma < -0.8, to the periphery of
galaxy clusters, i.e., log Sigma =~ 0.8, we find no dependence of the
relationship between galaxy stellar mass and gas-phase oxygen abundance, along
with its associated scatter, on local galaxy density. However, the star-forming
gas in galaxies shows a marginal increase in the chemical enrichment level at a
fixed stellar mass in denser environments. Compared with galaxies of similar
stellar mass in low density environments, they are enhanced by a few per cent
for massive galaxies to about 20 per cent for galaxies with stellar masses <
10^{9.5} solar masses. These results imply that the evolution of star-forming
galaxies is driven primarily by their intrinsic properties and is largely
independent of their environment over a large range of local galaxy density.
