You should ask officially, as others (notably BrianH) answered. At some places and countries, your university -or research organization funding your PhD work- will even help you (perhaps with a paid leave and/or some business incubator). At other places, it will forbid that and you could be sued. Perhaps your advisor might be helpful (so consider speaking with him about that startup idea, if you are on good terms).
In France, where I live, getting help on a startup with a PhD idea is probably easy (thru clusters like Systematic, BPI France, etc...). The official stance is that France is wanting more of that (and provide dedicated funds to help that), and it is likely to be the same in most European countries.
However, I recommend finishing your PhD (with 3 years of work on it you probably are not very far from that), get the official doctoral degree, and later on work on your startup (with approval, in some official setting which might ask you to give some parts of your company to the University or some other licensing terms, and perhaps help, from your University). An abandoned PhD work is a failure.
Even if your startup works, having the PhD (really) shows that you are able to end a difficult challenge. And if your startup fails (which is likely, since most of them do) the PhD is a useful blanket (or safety net) to have. 5 to 10 years later from now, having a PhD on your business card could make a lot of difference (and perhaps earlier: I guess that banks will more easily lend you money if your startup has the blessing of your University or research institution, whatever that means).
Conversely, dropping your PhD work right now, so close to finishing it, is probably a very stupid thing (and could send the wrong message to future VCs or potential clients : that you cannot be trusted because you are impulsive). Think a lot before committing that.
BTW having a working code on some research problem is really different from being able to sell it successfully (and requires different skills). And a research prototype software is quite different from a commercial product.