Since the pilot light is such an important consideration in keeping any gas fired appliance operating, I thought I would explain how a gas valve works so that people with gas fired boilers and furnaces would know how to diagnose a problem with the boiler or furnace not firing up or the pilot light going out.
The following applies to gas valves in North America, but I expect the principles of operation would be similar in Europe since safety is the primary consideration.
Also, I'm a handyman, not a heating contractor. If anyone reading this sees anything in the following explanation isn't exactly correct, would they please correct me so that everyone reading this will be sure to get the correct information.
Basically, inside a typical gas valve you will find of two valves plumbed in series, both of which are operated by electromagnets.
The small tube that leads to the pilot light is connected between those two electrically operated valves.
The electrical voltage generated at the pilot light is used to hold the first valve (often called the "safety valve") open. So, as long as the pilot light is burning, then enough voltage is being produced to energize the electromagnet holding the safety valve open so that the gas can flow through that safety valve and then up the tube going to the pilot light.
The second valve is the valve that allows the gas to flow to the main burner trays of the boiler, furnace or hot water heater.
On a boiler or furnace where electrical power is needed to operate a circulating pump or blower anyhow, then normally a transformer in the boiler or furnace will provide low voltage to operate the electromagnet for the second valve in the gas valve (often called the "main valve"). In North America, this "main valve" electromagnet will operate on 24 volts AC. Boilers and furnaces will have a THERMOCOUPLE sitting in the pilot light that generates a few millivolts to operate the electromagnet that opens the safety valve.
On hot water heaters which don't require electrical power to operate a pump or blower, then instead of a thermocouple, you'll have a "THERMOPILE" sitting in the pilot light. A thermopile is just a whole bunch of thermocouples all connected in series to generate a much higher voltage from the same pilot flame than a thermocouple would. Hot water heaters will use the 1 volt (approximately) that a thermopile produces to power the electromagnets of both the safety and main valves inside the gas valve.
Now, gradually, over time, the voltage generated by a thermocouple or thermopile sitting in a pilot light will decline. Once it gets to the point where that voltage is no longer sufficient to power the electromagnet holding the safety valve open, then the safety valve will close, stopping the flow of gas to the pilot light. In that case, no gas can flow to the main valve going to the burner trays either.
However, if the pilot light is burning, but the gas valve isn't opening, then on a hot water heater it would indicate that the gas valve needs to be replaced, probably because or an open circuit in the second electromagnet. However, before replacing that gas valve, check for continuity across the thermostat on the hot water heater. It could be that the thermostat is not making the circuit to the electromagnet of the main valve so that the main valve isn't getting the power it needs to open.
On a boiler or furnace, where that second electromagnet is operated by power from a low voltage transformer, check to see if there's voltage in the wires going to the gas valve. If not, then the problem is in the controls on the boiler or furnace (or the power to the boiler or furnace being turned off altogether at the wall switch). In any event, the problem is that the gas valve isn't getting the voltage it needs to open from the control circuits on the boiler or furnace, not that the gas valve is faulty.
If there is voltage in the wires going to the gas valve, and the gas valve still isn't opening, then the problem is probably a bad gas valve.
But, in most cases, if the pilot light goes out, it's probably just an old thermocouple or thermopile that needs replacing.
Also, thermocouples and thermopiles generate their voltage at the end that sits in the flame, and the length of the wire between the pilot light and the gas valve doesn't really matter. So, you can replace a 24 inch long thermocouple or thermopile with a 60 inch long thermocouple or thermopile; the gas valve will still get virtually the same voltage. It's no different than using a short extension cord or a long one in that respect.
If you have a pilot light on your hot water heater, boiler or furnace, it's always a good idea to have a spare thermocouple or thermopile around in case the pilot light goes out. Most of the time the reason why a pilot light goes out is just due to an old thermocouple or thermopile, so most of the time you can fix the problem yourself by replacing the thermocouple or thermopile, but there can be other reasons like the crossdrafts that were mentioned by another poster.