The short answer
Fungi need water, a food source they can absorb, oxygen for most of their life cycle, and a temperature and pH within their range. Mineral nutrients support growth too. Requirements vary by species, so treat the ranges here as general guides.
Moisture and water activity
Water matters in two ways. Fungi need it to take up nutrients, and it keeps hyphae and fruiting bodies from drying out. Mycologists describe a fungus’s moisture needs with water activity, a measure of how much water is available to organisms, on a scale from 0 to 1.
As rough guides, hydrophilic fungi grow best at very high water activity, about 0.95 or above. Mesophilic fungi grow best near 0.90. Xerophilic fungi tolerate drier conditions, roughly 0.65 to 0.85. A few extreme xerophiles can grow at even lower levels, but they are specialized species.
Food: carbon, nitrogen, and minerals
Fungi need carbon from organic material. Most digest food outside their bodies and then absorb the result. Carbon sources include sugars, starch, cellulose, and lignin, depending on the species. Nitrogen is needed to build proteins and nucleic acids. Fungi also need minerals such as sulfur, phosphorus, magnesium, and potassium, along with trace metals such as iron, copper, manganese, zinc, and molybdenum.
The growth and nutrition of fungi are tied together, since what a fungus can eat sets how well it grows. Saprophytic fungi break down dead material, parasitic fungi feed on living hosts, and mutualistic fungi trade with plants. Cellulose-degrading fungi and ligninolytic fungi are specialists in plant material such as wood and straw. Many wild mushrooms are saprophytes or partners of tree roots, and that difference affects where they grow.
Temperature
Most fungi are mesophiles, growing best at moderate temperatures. Relatively few grow at or above 37 °C. Thermophiles grow at high temperatures and turn up in compost, where heat builds as the material breaks down.
Cold slows growth, and extreme heat or cold can damage mycelium. Growers often ask what temperature kills mycelium. The answer depends on the species and on how long the exposure lasts.
Acidity (pH)
Many yeasts and molds tolerate a wide pH range, from about 3 to above 8. Many grow best near pH 5. Some species handle acid better, and others prefer alkaline conditions. Many filamentous fungi also change the pH around them as they grow.
Oxygen
Most fungi are aerobic, so they need oxygen at least at some stages of their life cycle. Oxygen moves slowly through the thin water films around hyphae, so low oxygen can limit growth. Carbon dioxide can build up in closed spaces. Growers track mushroom CO2 concentration in growing rooms and provide fresh air, since high carbon dioxide can change how mushrooms form, including stem length.
Growth is not the same as fruiting
Mycelium can grow under conditions that don’t trigger fruiting. Mushroom-forming species usually need extra cues to fruit, such as high humidity, fresh air, and, in many species, a change in temperature or light.
A note for foragers
The same basic needs shape where wild mushrooms appear: water, a suitable food source, and mild conditions. These are general patterns, not a test. A mushroom’s habitat and the season can’t confirm that it’s safe to eat. Have any wild mushroom identified by an experienced expert before you eat it.