Start by seeing where the port is actually being set by running this:
select setting, source, sourcefile, sourceline from pg_settings where name= 'port';Cheers,Greg