This paper deals with the moment problem on a (not necessarily finitely generated) commutative unital real algebra A. We define moment functionals on A as linear functionals which can be written as integrals over characters of A with respect to cylinder measures. Our main results provide such integral representations for A+–positive linear functionals (generalized Haviland theorem) and for positive functionals fulfilling Carleman conditions. As an application, we solve the moment problem for the symmetric algebra S(V) of a real vector space V. As a byproduct, we obtain new approaches to the moment problem on S(V) for a nuclear space V and to the integral decomposition of continuous positive functionals on a barrelled nuclear topological algebra A.