Mapserver mapscript is a wrapper around the mapserver APIs that exposes them to a host programming language. Supported programming languages are: Python, Java, C#, Perl, Ruby, Tcl. PHP is also supported, it only differs from the others in how the API is exposed to the PHP interpreter.
That being said one of the ways you could invoke mapscript is by creating a script which simply emulates the behaviour of a standard, Mapserver-backed, WMS service.
There are some examples here:
There are several reasons for doing this: interpolation of results or input params, alteration of the resulting image, caching, accounting, etc.
Note: this feature is limited, not complete and still experimental, YMMV.