Use the PHP module's embedded interpreter to run the PHP within your Perl script (may or may not work; I just know this exists, I've never used it myself)
Given the similarities of PHP and Perl syntax, it may be simple to convert the PHP file to Perl and do all of the work in a single program. If the only purpose of the txt files is to communicate data to PHP, this could eliminate the need to create them at all.