2
Directories that the script needs to be able to modify (create/delete/rename files within the directory) require 777, and files that the script needs to be able to modify require 666.
Directories that the script doesn't need to modify can be 755, and files that the script doesn't need to modify can be 644.
That's if the script runs as a user other than the user who owns the files, which is typically the case.
If the script (i.e., the web server) runs as the same user who owns the files, or if the server uses PHP Suexec, then the permissions can be tightened to 700 and 600.
The above applies to Unix servers, not Windows.
Does that answer your question?