The hard resource limit is per container so the memory limit you set there will be the sum of all your PHP processes as well as any other processes you spawn, user SSH, etc.
The php.ini limit can be overridden by the client with ini_set() whereas the cgroup "hard resource limit" cannot - this is the upper bound of the website's resource usage.
It's generally preferable that a site hits the php.ini limit before the container limit as this will be a more graceful error which can be logged (using PHP error_log) or displayed to the user at the developer's discretion.