Strip one line comments:
cat file.php | perl -pe 's/^\/\/.*$// > file2.php
file2.php will now be stripped from one line comments
Strip multi line comments:
cat file2.pp | perl -pe '$/ = ""; s/\/\*.*?\*\///sm' > file3.php
file3.php will now be without multi line comments
Strip blank lines:
cat file3.php | perl -pe 's/^\s+//' > file4.php
file4.php will now be stripped from blank lines
A quick and dirty one
