Place the text layer below the image you want to fill the text with.
Hold down the Option/Alt key and click between the photo and text layer in the Layers Panel. You'll see a little down arrow cursor when you should click.
This will treat the text as a clipping group and only show the photo where the text is. Text remains live so you can edit it if needed.
To address comment below....
- Create the gradient background layer, then solid color layer, and a
- highlight the text and solid color layer in the Layer Panel and group them
- Highlight the group you just created and from the Layer Panel menu choose Blending Options
In the Blending Options Dialog there are two sliders at the bottom for "Blend if". For the top slider, click and drag the arrow on the right towards the left until the white text disappears.
And there you have it. If you need to edit the text, go ahead. Expand the group and edit the text. As long as it remains white it will be subtracted from the layer below the group.
This technique is dependent upon the color of the layer pixels. In some cases you may need to move the Blend If sliders differently to achieve the appearance you want.
I chose to group the text and solid color so that the group would be altered by the content below it. You could use the Blend If sliders on only the text layer if desired. Results and necessary slider settings may be different in that case.