On the SitePoint PHP blog today Troels Knak-Nielsen has a quick tip for those looking for a way to have their command-line PHP scripts be more interactive.
Just a quick tip, since I spent a good hour figuring this out recently. PHP has no native way of doing an interactive password prompt, when running as CLI. You can however use bash for the task.
His method (for both Windows and Unix systems) uses shell_exec command to run a VB Script/bash command that handles the password prompt for the PHP script. The result is then passed back into a variable and returned back to the calling application.