PHP cli script for flushing drupal cache
Install Drush. It's your friend. Then you can issue

drush cc all


To clear caches.

You can also rebuild registries if needed to if you have that module installed.