cacti-poller settings

after activating the cacti poller I get the following error:
script tried to disable memory_limit by setting it to a negative value -1 bytes which is not allowed
after some googling I found the following solution:

  • the memory_limit must be set to a reasonable value (like 128M) in /etc/php5/cli/php.ini; value “-1” is not allowed
  • the file /etc/cron.d/cacti should be modified like this:
    "*/1 * * * * www-data php --define suhosin.memory_limit=512M /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log"
  • and the file /usr/share/cacti/site/poller.php, line 297 as:
    "$extra_args = "-q --define suhosin.memory_limit=512M "" . $config["base_path"] . "/cmd.php"";"