The total median pay package for chief executives at S&P 500 companies rose to $12 million last year.

The number -- which includes salary, stock, bonuses and other compensation -- is 7% higher than in it was in 2017, for an average pay hike of $800,000 for large-company CEOs.

The median pay increase for the typical worker at an S&P 500 company grew just 3% last year, or less than half the rate that the top boss enjoyed.

It would take 158 years for the typical worker at most big companies to make what their CEO did in 2018.

Did you get a 7% raise last year? Didn't think so. But, hey, if you did, then congratulations: Your raise was in line with what CEOs at the biggest companies got -- only for chief executives, that 7% was roughly $800,000 in additional compensation.

Pay for CEOs at S&P 500 companies rose to a median of $12 million last year, including salary, stock and other compensation, according to data analyzed by Equilar for the Associated Press. The eight-figure packages continue to rise as companies tie more of their CEOs' pay to their stock prices, which are still near record levels, and as profits hit an all-time high last year due to lower tax bills and a still-growing economy.

Pay for typical workers at these companies isn't rising nearly as quickly. The median increase was 3% last year, less than half the growth for the top bosses. Median means half were larger, and half were smaller.

Get Breaking News Delivered to Your Inbox

The survey showed that it would take 158 years for the typical worker at most big companies to make what their CEO did in 2018, seven years longer than if both were still at 2017 pay levels. And when top executives are already making so much more than their employees, the bigger percentage raises compound the widening financial gap.

Anger about widening income inequality is rising around the world, from Capitol Hill to protests in streets. But it's only slowly seeping into the conference rooms where boards of directors set the pay for CEOs. Boards are often more concerned with what a competitor may pay to poach their CEO than how much more that person makes versus the rest of the workforce.

"It's a natural thing for a CEO and a board to say, 'How are others who are doing similar work paid?' And there's a natural sense that if the board believes and supports their CEO, they don't expect their CEO to be paid less than the others in the industry," said Eric Hosken, a partner at Compensation Advisory Partners, a consulting firm that works with boards.

Investors — the ultimate corporate bosses who have the power to vote directors off the board — also continue to vote overwhelmingly in favor of executive pay packages at the biggest companies, though the margins have been decreasing.

"There's a belief that if we underpay our CEO, they can go work in private equity. They can go work for a competitor. They will find places to go," Hosken said.

The AP's CEO compensation study included pay data for 340 executives at S&P 500 companies who have served at least two full consecutive fiscal years at their companies, which filed proxy statements between Jan. 1 and April 30.

Some companies with highly paid CEOs did not fit these criteria and were excluded, such as Safra Catz and Mark Hurd, co-CEOs of Oracle. Each had compensation valued at $108.3 million last fiscal year, but Oracle usually files its proxy statement in September due to its fiscal year ending in May.

Who's on top: Media company CEOs, often

Last year's top paid executive in the survey was David Zaslav of Discovery, the media giant behind HGTV and the Food Network. His total compensation was valued at $129.5 million, up 207% from a year earlier. Like other executives at the top of the rankings, most of Zaslav's pay is not from cash but from stock awards or option grants that he will fully benefit from only if Discovery's share price rises in the future.

Nearly 80% of Zaslav's compensation last year came from stock options valued at $102.1 million, most of which he received as part of a new employment contract that runs through 2023. Companies often grant big options packages when top executives renew their contracts. Discovery's stock returned 11% last year, beating the S&P 500's loss of 4%, including dividends, and it has also beat the market since its initial public offering in 2008.

Media CEOs tend to dominate the top of the rankings for compensation, corralling as much or more in compensation as the stars who work for them. Robert Iger of Walt Disney Co. was No. 2 on the Equilar/Associated Press list of highest-paid CEOs, with total compensation last year valued of nearly $67 million, while Richard Handler of Jefferies Financial Group was No. 3, with $45 million, double his 2017 compensation. Others in the top ranks iinclude Hologic's Stephen MacMillan and Align Technology's Joseph Hogan -- both made $42 million last year -- and PayPal's Daniel Schulman ($38 million), Netflix's Reed Hastings ($36 million) and Comcast's Brian Roberts ($35 million).

Disparity deepens between worker pay and boss pay

This is the second year that the government has required companies to show how pay for top bosses compares with the pay for their typical worker. The measure is far from perfect, mostly because companies have a lot of flexibility in how to calculate the numbers.

Comparisons between companies can also be meaningless when one has mostly part-time workers in developing countries while the other has office parks full of Ph.D.s in Silicon Valley. But now that companies have submitted two years of data, investors can see how the gap in pay is trending at individual companies.

At more than 40% of the companies in this year's survey, the CEO's pay rose by at least double the percentage of the median worker's pay gain.

Across the economy, pay is climbing at a faster rate for workers, but the gains are still below where they usually are when the economy is this healthy. Average hourly pay rose 3.4% in February from a year earlier, the largest annual gain in a decade. Companies find that they have to pay more to hold on to staff after the unemployment rate dropped to a nearly 50-year low.

But the last time the jobless rate was almost this low, in the late 1990s, hourly pay rose at a 4% to 4.5% rate. Economists say several trends are holding back wage gains, including businesses facing intense pressure from online and overseas competitors. And with larger, multinational companies dominating more industries, workers have fewer alternatives to jump to in search of a raise.

"For the kind of numbers we're seeing on the unemployment rate, or the length of the recovery, all those numbers would tell us that we're in an incredibly good economy. But it's not as rosy as those statistics suggest," said Julia Coronado, an economist and president of MacroPolicy Perspectives.

The few female CEOs made more than the many males

In some industries, worker pay is closer to the CEO's. Some tech CEOs have famously low salaries, such as Lawrence Page of Google's parent, Alphabet, and Jack Dorsey of Twitter. Both took home a $1 salary last year, but both also own huge stakes of their companies as co-founders.

Tech companies also often pay high salaries to lure in programmers and data scientists. At Alphabet, for example, the median employee had compensation of $246,804 last year, up 25% from the year before.

High salaries of more than $100,000 are most typically found in a more staid area of the market: utilities. Most of the big utilities paid their median worker above $110,000 last year, but that may not last for long. Compensation fell for the median worker at most utilities last year.

Women, meanwhile, still remain relatively rare in the corner offices for S&P 500 companies, even though they enter U.S. companies at roughly the same rate as men. Of the 340 CEOs in this year's survey, just 19 were women. Their median pay was $12.7 million last year, versus $11.2 million for men.

Most shareholders sign off on big raises for chief execs

For the most part, investors are OK with these big pay packages. Last year, the median company in the survey received a 94% approval rate on its "Say on Pay" vote, where shareholders give a nonbinding up-or-down vote on executive compensation. That was down only slightly from 95% a year earlier.

But those high approval numbers belie increasing scrutiny of executive compensation by shareholders.

"It's accelerating a lot," said Rosanna Landis Weaver, researcher at As You Sow, a shareholder advocacy group. "You have scholarship showing how widening income inequality is bad for everyone, shareholders and democracy. And the myth of 'pay for performance' has taken a couple of blows, so people are re-examining pay."

In many cases, the dissenting voices are coming from shareholders outside the United States.

"I have the impression that here in the U.S., the culture is still — maybe rightly so — that if your CEO is successful, you are entitled to make basically as much money as you want," said Luca Paolini, chief strategist at Pictet Asset Management, which is based in Switzerland. "In Europe, we think slightly differently. And in Japan as well. They say, 'Ok, your company is great, you should give back something.'"