Change how php extension dir is detected and used