I need to grant write permission to temporary folder of all local machine (if it does not have)which access my php site. Is it possible using PHP?
No, you can't because PHP works server-side only! PHP is used to create HTML output and cannot access files on client-side machines.
chmod('path/to/my/folder',777); will only change file permissions on the server machine - never on a client!