I am confused about using php or python for implementing server program.
I seems that there are not only syntax differences.
For example, the php program is short-lived (only exist when request comes and die when response is generated) and it can only store things in DB rather than memory.
But for python (using TwistedWeb), the python program is long-lived. It can hold things in memory, doing something else when there are no request.
Am I wrong? I am confused and please help me to clarify it.
Lets answer your questions one by one:
Correct, they are two very different languages. PHP in versions > 5.3 is quite mature, but it is rather subjective. Python is very well designed language.
Incorrect. PHP was designed as such, as far as I know, but that does not mean you cannot use it for longer processing, or for storing some things in memory (PHP can eg. use memcached).
Twisted is for writing server-like scripts, but Python can also work in a per-request basis.
Yes, you are wrong about the above:
You are right about some things, though: