The general expression of the effective pairing Hamiltonian is proposed to obtain the multicomponent Ginzburg-Landau free energy functional for strongly anisotropic layered superconductors. The effective Hamiltonian contains an intralayer pairing interaction as well as all possible interlayer pairing potentials. It is shown that the problem with many order parameters can be reduced to the problem with two order parameters which characterize the effective intralayer and effective interlayer pairings, The interlayer interaction (V) over tilde(0), which corresponds to the coherently hopping of pairs from one layer to the nearest neighboring layers, renormalizes the Josephson tunneling strength for an intralayer effective order parameter. Mixing of two order parameters is characterized by the Lifschitz invariant in the free energy functional. The Lifschitz invariant is enhanced due to the interlayer pairing potential V-01 which represents an interaction of two particles on the layer with scattering one of them into the nearest neighboring layers. The interlayer interaction V-01, also stabilizes the mixing of two-order parameters. Since in the absence of V-01 the Lifschitz invariant vanishes for a half-filled band of two-dimensional electrons in a layer. The transition temperature T-c to the superconducting state and upper critical magnetic field H-c2 are calculated. Effects of all possible interlayer pairing interactions on T-c and H-c2 an studied. (C) 1998 Elsevier Science B.V.