Single supply inverting amplifier
The current produced by the photodiode in the presence of light is a reverse current not a forward current. This means current flows from R1 thru D1 to ground. 

This means that to keep both input pins of the op-amp at the same voltage (e.g. 0V), the op-amp output has to rise above 0V to feed current into R2 thus keeping -Vin and +Vin at precisely the same potential\$^1\$. As more light hits the photodiode the op-amp output has to rise higher.

If the photodiode were the other way round photo-current would be traveling into R2 and this means the op-amp output has to provide negative voltage and, of course it can do this when it has a negative supply.

I'm assuming you are using rail-to-rail op-amps in this analysis.

Same problem with solar cells - you need the left hand end of R1 to be pulled negative by the solar cell for this to work.

\$^1\$ If you don't understand why -Vin = +Vin then this is another question and is unrelated to photo-diodes or solar cells.