Why does psql work when called from shell, but not when included in a plugin PHP file?

Why does psql work when called from shell, but not when included in a plugin PHP file?

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)