As laserlight said: if security really is a big issue for you, then switch to php 5.
What do you mean by "It just won't work on php5"? Why not change it, so that it does work?
Ohter than that you can play around with:
ini set
and with .htaccess directives.
But none of those are actually worth the effort, if you really need high security (PHP5 would still be wiser)