1. A growing number of studies incorporate functional trait information to analyse patterns and processes of community assembly. These studies of trait-environment relationships generally ignore phylogenetic relationships among species. When functional traits and the residual variation in species distributions among communities have phylogenetic signal, however, analyses ignoring phylogenetic relationships can decrease estimation accuracy and power, inflate type I error rates, and lead to potentially false conclusions. 2. Using simulations, we compared estimation accuracy, statistical power, and type I error rates of linear mixed models (LMM) and phylogenetic linear mixed models (PLMM) designed to test for trait-environment interactions in the distribution of species abundances among sites. We considered the consequences of both phylogenetic signal in traits and phylogenetic signal in the residual variation of species distributions generated by an unmeasured (latent) trait with phylogenetic signal. 3. When there was phylogenetic signal in the residual variation of species among sites, PLMM provided better estimates (closer to the true value) and greater statistical power for testing whether the trait-environment interaction regression coefficient differed from zero. LMM had unacceptably high type I error rates when there was phylogenetic signal in both traits and the residual variation in species distributions. When there was no phylogenetic signal in the residual variation in species distributions, LMM and PLMM had similar performances. 4. LMMs that ignore phylogenetic relationships can lead to poor statistical tests of trait-environment relationships when there is phylogenetic signal in the residual variation of species distributions among sites, such as caused by unmeasured traits. Therefore, phylogenies and PLMMs should be used when studying how functional traits affect species abundances among communities in response to environmental gradients.