Around the perimeter of the gear, inside the line of teeth, you should be able to make out 6 small circualr formations, that were created when the gear was molded. This 6 circles make perfect outlines for drilling holes. Find a good bit for the job and put 6 holes though the gear. Replace the gear back in the housing and drill a hole for the diode and transistor above and below the gear. If you need more room you can shave the gear down a bit.
Most gears have a ridge around the outside that can be shaved down to make more room.
Place the photodiode and transistor above and below the gear so that they face each other. Hot glue them in place and make sure that they don't hamper the movement of the gear. Put a resistor in series with the the photodiode and power it up. Measure the resistance of the phototransistor as you turn the shaft. Make sure that your have the negative lead of your multimeter hooked up to the negative lead of the transistor and the same for positive.