Please visit the Cacti website at http://www.cacti.net/download_patches.php If any patch has been released, you will find installation instructions there.
As an example, please find patch installation instructions for cacti 0.8.6j here. Do not apply those patches to recent releases!
wget http://www.cacti.net/downloads/patches/0.8.6j/ping_php_version4_snmpgetnext.patch wget http://www.cacti.net/downloads/patches/0.8.6j/tree_console_missing_hosts.patch wget http://www.cacti.net/downloads/patches/0.8.6j/thumbnail_graphs_not_working.patch wget http://www.cacti.net/downloads/patches/0.8.6j/graph_debug_lockup_fix.patch wget http://www.cacti.net/downloads/patches/0.8.6j/snmpwalk_fix.patch patch -p1 -N < ping_php_version4_snmpgetnext.patch patch -p1 -N < tree_console_missing_hosts.patch patch -p1 -N < thumbnail_graphs_not_working.patch patch -p1 -N < graph_debug_lockup_fix.patch patch -p1 -N < snmpwalk_fix.patch
You might need to reapply file/folder security on the files patched. Double check they are correct.
Please pay attention not to break cacti when using SELinux or using NTFS file security. If you encounter
PHP Warning: include_once(./lib/html_tree.php) [<a href='function.include-once'>function.include-once</a>]: failed to open stream: Permission denied in /var/www/cacti/graphs.php on line 33, referer: http://localhost/cacti/graphs.php
or the like, it is very likely that your permissions are wrong.