To the GP's point, the total cost of ownership of a plant that makes gasoline-level fuel is going to be more about water and land than anything else.
But the efficiency of solar panels, considering their subsidies, the rare minerals used in their manufacture, their delivery and their maintenance... I'm confident it's a lot less than e.g. coal, even accounting for pollution costs, because if it really were cheaper all-around we'd be using it everywhere!