The purpose of this paper is to introduce some new classes of rings that are closely related to the classes of almost Bezout domains and almost Prufer domains. Suppose that H = {R vertical bar R is a commutative ring with 1 not equal 0 and Nil(R) is a divided prime ideal of R}. Let R is an element of T(R) be the total qoutient ring of R, and set phi : T(R) -> R-Nil(R) such that phi(a/b) = a/b for every a is an element of R and b is an element of R \ Z(R). Then phi is a ring homomorphism from T(R) into R-Nil(R) and phi resticted to R is also a ring homomorphism from R into R-Nil(R) given by phi(x) = x/1 for every x is an element of R. An ideal I of R is phi-invertible if phi(I) is invertible ideal of phi(R). A ring R is a phi-almost Bezout ring (phi-AB ring) (respectively, phi-almost Prufer ring (phi-AP ring)) if for nonnil elements a, b of R, There exists an n = n(a, b) with (a(n), b(n)) is a nonnil principal (respectively, phi-invertible) ideal of R. This paper is devoted to study the phi-AB rings and phi-AP rings.