voltage comparator always on
As long as the anode of the photodiode is not connected, the input will not be driven to any particular voltage. Simply reading the voltage across the diode does not mean that it will be seen as such by the circuit.

Ground the anode.

Edit - Sorry, but I got turned around. The cathode should be grounded, and the anode tied to the comparator. Alternatively, provide a reference voltage greater than 1 volt, and connect the anode to that.