About 1 to 2 years. Highly variable by technology.
There is a persistent myth that solar panels take more energy to fabricate than they produce in their lifetime. It is shown false with minimal effort (consider if the entire cost of a panel was energy. no labor, not capital equipment overhead, no raw materials… they still have payback periods shorter than their lifetimes).
I don't have a number, but the exotics that are used in space applications may never pay back their production energy. But it takes a lot of extension cords to reach geosynchronous orbit.
Basically, Greenhouse gas emission including construction, material acquisition, maintenance etc. per kWh im g CO2:
Solar: 32
Nuclear: 66 (which assumes that enrichment is done with conventional energy)\
Coal: 960
This page [0] discusses this question. It's in German but the Google translation is not bad. The energy required to produce both solar and wind energy has decreased significantly in recent years.
Solar power in Germany (the page claims) takes between 15 - 100 months to generate as much energy as producing them takes. I assume 100 is for old panels, and with modern (=more efficiently produced) panels it's more like 15. Wind power takes just 3 - 23 months to establish this "energy payback".