Alternative to LM317
When using a solar power source your voltage input has a very wide range from zero up to more than you need, hopefully.

Using a standard linear regulator will therefore only work when the solar panel is producing more voltage than the minimum required for the regulator to control the output voltage. If the voltage from the solar panel is less than that the regulator will simply pass it through with a voltage drop.

Further, a linear regulator's efficiency drops off quickly as the input voltage rises. This wastes power and creates issues with heat control of the regulator.

For applications like this you need to use a buck-boost, also known as step-up/step-down, switch-mode regulator. Example



These circuits use pulse width modulation control of current through an inductor to efficiently convert the input voltage into your desired output voltage.

When the input voltage is higher than your desired output they operate in "buck" mode. When the input voltage is less they utilize boost mode.

You can expect efficiencies in the high nineties when operating in buck mode and at least in the eighties in boost mode.

There are numerous cheap and small buck-boost regulator boards available on-line. Chose one that outputs the voltage level you need and accepts the kind of input voltage range you expect to receive from your panel. Make sure the device has the current capability you need.

NOTE: You may however still need some sort of circuitry to disconnect the power source when the voltage drops below your required low limit. Better boards may already include that feature.