thanks but when i run the script access is always closed
Is it closed by everyone else, too? Meaning, if the file is on a shared server, does no one else have it open? Make sure.
If it turns out that it is totally closed, then you have a permissions issue. Enable, at a minimum, Read permissions on the directory and database for your web server's anonymous (or if your security is different, your server-specific) user account. Also ensure you are authenticating properly to the server.