Refactor PHP init code.