What should I do now to go ahead and restart my aspirations to become an appropriate candidate for a Ph.D. program? According to Dr. Daniel G. Amen, each person has his personal definition of success. Therefore, you can't argue with anyone regarding their personal definition of success. My personal definition of success is to have a Ph.D. in CS and become a teacher in a university. To me, not having a Ph.D. is like living as an incomplete human being. I have become so obsessed with the idea of having a Ph.D. that I have already sacrificed various things for this ambition, and I am prepared to sacrifice more.
Now, for me the problem has been, due to my undiagnosed clinical depression and, apparently, insufficient math background, I dropped out of two Masters in CS programs from two different EU universities. Now, I am taking the medication regularly, and in a stable situation.
I never wrote a thesis before, and don't have any publications.
What should I do now to go ahead and restart my aspirations to become an appropriate candidate for a Ph.D. program?

Do I need to go return and complete my MSc degree in order to get accepted into a Ph.D. program?
If I must go back to an MSc degree, would a 1-year MSc suffice given that the MSc programs I dropped were of 2 years in length?


A comment by Peter caught my eye:

obviously, I can't tell with certainty because I don't know OP but mental health issues, an obsession with completing a degree just for the sake of the title, and subpar math skills are not a promising combination.

I would like to reply this.
Firstly, if I were not stuck with my health issue and math skills, I wouldn't have come to academia.SE, and probably would be answering this type of question for others. academia.SE is here to give suggestions.
Secondly, I am having my medication regularly, and I am having good health now. That is why I am thinking about restarting my journey.
Thirdly, I have been studying college and graduate-level mathematics for the last three months. I have been improving. Probably, I will sit for the GRE Math subject test at the end of this year.
Fourthly, yesterday, I have received a national scholarship from an EU-country to work on a research project. So, I think, I still have something in me.
Fifthly and finally, read Napoleon Bonaparte's story about Line of Fate. This is probably a fictional story, but you get the idea.
Your post does not explain the broader motivation for your goal to complete a PhD program, and it also sounds like you have some problems that are going to make that an arduous (and possibly unsuccessful) journey.  Candidature in a PhD program is often difficult and stressful even for the most elite students with no accompanying clinical depression.  For that reason, I recommend you take a moment to reflect on whether you really need to complete a PhD in your field in order to achieve your broader life goals, and whether this period of your life is the appropriate time to do that.  Nevertheless, I will take the premise of your question as given, and try to give some basic advice on how to achieve your goal.
As with the acheivement of any goal where you have already made failed attempts, it is important to identify the impediments that are presently preventing success, and then overcome those impediments.  Your post identifies two impediments to your success: (1) depression; and (2) insufficient maths background.  I will leave it primarily to medical people to assist you with the first, but I will just mention that you might find some wisdom and assistance in reading some of the philosophy of the Stoics (particularly Epictetus and maybe also Seneca the Younger).  As to your insufficient math background, the simplest way to improve this is to undertake revision on all your previous mathematics courses, with particular attention to the mathematics you encountered in your previous MSc program.
You mention that you do not have any academic publications, and I think it is premature to attempt this.  However, once you have learned some more of the base material in your field you could start out by trying to publish small posts about it on relevant websites.  Since you are already using StackExchange, once you learn some more mathematics you could attempt to answer some questions on Math.SE or CS.SE.  Another possible activity here is to write some blog posts explaining the mathematics you have learned to other students at your level.  These are all &quot;publications&quot; in a minor sense (though not academic publications), and they are a reasonable way to practice making public posts about mathematics that can be subjected to critical feedback from experts.
In these circumstances, where you are already struggling, I think it would be beneficial to complete your MSc program before attempting entry to a PhD program.  The main reason for this is to give you an opportunity to complete postgraduate level coursework and improve your skills (including your math skills) up to a level that would make you competitive for entry into a PhD program.  A secondary reason is that you may then obtain some ideas for possible research projects (and supervisors) that you could pursue as a first attempt at academic publication.
To finish, I will just make two last points.  It is possible for weak students to improve and later be competitive students for higher-degree programs.  That is usually a long and difficult process, but it is certainly possible for a student with sufficient diligence and commitment.  Having said this, it is also important to ensure that you are setting reasonable life goals that are actually going to lead you where you want to go.  Some students (and I am certainly not saying you are in this category) look at the PhD program as a kind of elite social-proof and they pursue it as an end in itself, rather than taking a realistic view of what it will actually add to (and subtract from) their career or life.  Take some time to reflect on your broader life goals and consider what you really need to be successful in your life.  Good luck.