The statement should be added into the top script that calls write_config_file() function. This will prevent the same file being silently included several times and cause php error.