You probably want to check your system calls for errors. The convention is to return 0 for "no error" which is the same as FALSE which can be confusing. You need to do something like:
<?php
$cmd = "/usr/bin/pngtopnm $png_file > $pnm_file";
system($cmd,$return_value);
($return_value == 0) or die("returned an error: $cmd");
?>