I is the current carrying in the wire and L is the side of the square loop. The loop is placed at a distance a from the wire. Then the magnetic field is given by :
B=μ0I2πx
From the definition of flux
dϕ=B.ds
=μ0I2πx.adx
so,ϕ=μ0aI2πa+L∫a1x
ϕ=μ0Ia2πln(a+La)
Therefore, the flux will be, ϕ=μ0Ia2πln(a+La).