The second electronic hyperpolarizability (gamma) of the phenol blue (PB) in several solvents in a wide range of dielectric constants is investigated using the Density Functional Theory. The performance of hybrid functionals, with and without long-range correction, is addressed by comparison to Hartree-Fock calculations. Among the employed exchange-correlation functionals, the LC-BLYP functional is suitable for describing the behavior of gamma in solution. LC-BLYP results indicate a clear relationship between the second hyperpolarizability and the bond length alternation (BLA) coordinate for PB in solution, in agreement with experiment.