$zipped_file = パス . "/" . ファイル名 .".zip";//書き出し先のzipファイル
$command = "cd " . "パス" . "; zip -P " . "パスワード" . " " . $zipped_file ." " . "元ファイル名" ;
exec($command);
これで、パスで指定したディレクトリにパスワード付きのzipができます。
あとは、readfile関数でそのファイルを指定すれば、ブラウザに書き出します。
その前に適切なヘッダを書き出す必要があります。
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=" . "ファイル名");//ダウンロードした時のファイル名
//クライアントがwinだったら、SJIS, MacならUTF8でファイル名出しわけが必要
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . strlen(ファイルへのフルパス));//ファイルサイズを取得
これぐらい書き出せば大概のブラウザでダウンロードできます。