If you have global indexing turned on for Apache:
Options Indexes
You may wish to leave it enabled but still stop indexes being displayed.
Using find and xargs you can create an empty index.html in each directory and Apache will serve it instead of the list of files in the directory thusly:
find -type d | grep -v \.svn | xargs -I '{}' touch '{}/index.html'
The above command says
find all directories starting from the current directory and below. Pipe the result from find to grep and tell grep to filter out any directorys with .svn in them. Finally use xargs to run touch replacing '{}' with the directory name passed from the grep command so you get touch ./my/dir/path/index.html
To undo:
find ./*/ -name index.html | xargs rm -f
Notice find is given a search path of ./*/ so you don't delete the index.html from the current directory you generally want an index.html in your web root directory.
How do i do this with php? No shell access...