in reply to Problems with opendir in CGI
You should look at the configuration of Apache (or whatever you're using). Chrooting apache into a loopback filesystem would mean that a CGI script could never "see" any file outside your cgi directory. Try creating a symbolic link to the directory in your CGI directory, and change /storage to ./storage. Also, if your web server is running with user / group of nobody (which it should be for security), it may not have permission for /storage.
Want to support the EFF and FSF by buying cool stuff? Click here.