zero cross detector for ac fan controll

i have tried and tested this zero cross detection but i have one problem is i cannot control ac 240 v bulb using optocoupler it flickers every time if anyone have solution please reply me

I assume you are going to control your mains powered fan with an SSR, since you're talking zero crossing.
A relay would be unreliable/slow there.
AFAIK SSRs come in zero crossing (for resistive loads) and non zero crossing (for inductive loads, e.g. a fan....).

Your zero crossing circuit should sort of work, but it won't be very accurate/narrow.
In the 1-1.5volt AC region there is the b/e threshold and you won't have enough base current to drive the collector low.
Are you going to use an Arduino. Then just feed the rectified AC into an analogue input with a simple voltage divider.

Take a look at this MAINS Power Dimmer/ Switch module, it has the zero cross detector circuit you are looking for:

Mains Power Dimmer / Switch Module