When his candle shined upon my head (comp. Psalms 18:28, "For thou wilt light my candle: the Lord my God will enlighten my darkness"). A "candle," or "lamp," is a general symbol in Scripture for life and prosperity.
God is said to light men's candles when he blesses them and maizes his countenance to shine upon them; conversely, when he withdraws his favour he is said to put their candles out (Job 18:6; Job 21:17).
And when by his light I walked through darkness. The light of God's countenance shining about a man's path enables him to walk securely even through thick darkness, i.e. through trouble and perplexity.