Whether it is possible or not depends you you and on the system itself. If there are required courses, then you need to be free to take them and do well. You need, in some systems, such as the US, to have the time for intensive study, not just research.
Some systems don't have time limits, others do. If you have to study at a slower pace then you might come up against time boundaries. In some systems there is a (perhaps) seven year limit. In some the limit isn't quite that strict, but things done longer than seven years ago no longer "count" toward a degree.
If you have a family or family responsibilities, it can be even harder.
You will also need a "compatible" advisor, but that is true of everyone. But they might need to accommodate odd hours.
Look at all of your options before getting into a no-win environment. Yes, it can be done, but only with great difficulty and lots of other sacrifice. Good luck.