It wouldn't be particularly efficient, given that most of the day less than half the panels would be receiving direct sunlight.
I think a more practical option would be to put the solar panels above the road, such as https://www.theguardian.com/environment/2011/jun/06/tunnel-s... or https://renewsable.net/2017/06/28/south-korean-bike-highway-...