A few weeks ago, I sent an email to a professor in a western European country in the hope of getting a Ph.D. position in the field of management. I have 17 years of work experience and 8 years of academic experience at the same time, I am a 45-year-old man, married, from Iran. Although the first round interview was successful, the professor called me on the phone and said that my age and marital status is his concern and the scholarship can only cover my expenses not my wife, I said I have enough money to cover my wife expenses and the evidence which was my life-time saving is available. At first, he said OK, but still do not receive any contact from that university. I have already asked questions that if my age can affect my Ph.D. application? Almost all of my friends said no, and I am almost sure that this is true in The United States and Canada. But I was shocked for the first time when I had such a conversation with that professor. I do not mention the name of the country and the university because it may seem immoral. Another question is whether it is moral to record all the interview by an application or software, and if you are judged by your age or any other personal issue then we can bring the case to the court of law?
Whether or not something is legal depends very much on the jurisdiction. There is nothing we can help you with without knowing what the country is (and even then it would not be a suitable question for this particular forum). This also pertains to the question of whether or not it is legal to record a conversation without the other person's knowledge -- this is different even from state to state within the US, for example.
As for the actual concern: Whether judging an application by the applicants age and marital status is legal is something that I cannot evaluate, as mentioned above. But from the perspective of a potential employer or student supervisor, it is a concern one could have: If you have a family and the university cannot cover your family's living expenses, it is probably that you might not finish the entire program or stay with the research project. If you have a family, you may also not be able to work as many hours as a 24-year-old single person. I would like to stress that I do not think that these are legitimate concerns to have without concrete evidence -- for example, one could have a conversation with an applicant about these specific points -- but it does not surprise me that some potential supervisors may have such concerns.
Yes, it is illegal to discriminate based on age in the area of employment and occupation (and often, a European PhD position is a form of "employment"). The legal framework is the same in all European union countries, based on directive 2000/78/EC. Martial status is not covered by any European regulations, but some individual countries do have laws concerning this.
All European countries also have a national equality body that can investigate alleged cases of discrimination (and provide a lower barrier-to-entry than the formal judicial system). They might be able to help you out and provide you with additional information. However, if you did not record the phone call and have no other evidence concerning the alleged discrimination, this will make it much harder to succeed.
"I said I have enough money to cover my wife expenses and the evidence which was my life-time saving is available"
Your iranian life-time saving may not be enough to cover things such as an american cancer treatment and the likes.
If they are, then you do not really need to have a PhD scolarship, you can find an alternative way of pursuing a PhD (to my mind comes the plan of having your PhD awarded somewhere else and keeping this US contact as external supervisor).