zip includes the paths to the files in the zip folder it creates by default. Add the
-j flag to
junk the paths and only include the file.
system('zip -j -P pass '.$zip.' '.$file .' ');
Check out the man page for
zip for more info.
$man zip ... -p --paths Include relative file paths as part of the names of files stored in the ar- chive. This is the default. The -j option junks the paths and just stores the names of the files.