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?