Very unclear what the problem might be without seeing code, but here's a thought:
Can the process generating the .ps file direct its output to stdout? If it can, you could have PHP run the command so that it outputs to stdout, PHP can collect the .ps data, and then PHP would be able to write the .ps data into a file.
Of course, if the command isn't outputting the data at all when run from PHP, then it can't output it to stdout either.