Why do you have an optocoupler? Why not just PWM through an RC network?
The Op Amp rail needs to be a rail, or you need to use a 15V supply voltage. An LM358 will only go to 1.5V supply voltage below its.
Or use a digital pot as part of the feedback / voltage network set on a linear regulator.
This DAC chip SPI interface is available in surface mount or PDIP for $ 6 each, minimum of 2 from Linear Technologies. It can run on up to 15V and so can output 0-12V Directly.