“envy.” The Hebrew word can refer to envy, jealousy, or zeal. These are all very strong emotions (and can be negative or positive (cp. Ps. 69:9)), but once a person is dead they have no emotions.
“a portion.” A share, and a “portion” can also refer to an inheritance (cp. Num. 18:20).
“forever.” The Hebrew can mean “forever” or just “for a long time.” In this case it can be both, because the wicked will be destroyed but the righteous will be resurrected to life on a glorious earth. Thus, concerning the righteous, the “forever” is technically a hyperbole for “a long time.” And it has indeed been a long time since Ecclesiastes was written.