This is a surprisingly common error for drupal users. Drupal has very powerful access control features, this is good. But it also means it's pretty easy to configure things in such a way that you prevent your users (usually the anonymous ones) from accessing content, this is bad.
I've run across this problem on many occassions, so I've put together a checklist that may help you debug your access problems.
- access control - Start here, does your user actually have access granted to him to view the content in question? Browse to your admin/access_control page and confirm that read access is granted for users on modules such as 'node'. If "access content" is not checked for anonymous users in the node access row, anonymous users will not be able to view any nodes! Check all the "access content" type values for all node types. Make sure they are the way you want them.
- User 0 - Make sure this user exists in all the appropriate tables. This is probably the most common reason for anonymous users being denied access. See my post, All Important User Zero, for more info.
- Make sure the author of the node(s) you are trying to view exists in your users table. There's currently a bug in Drupal in which if the author of a node can't be found in the users table, access will be denied to all for that node. To prevent this from happening, instead of deleting authors who are no longer part of your site, disable their account instead of deleting it.
- Make sure you're using the appropriate mysql extension. Check your settings.php file. If you're using "mysqli://" in your $db_url value, try using "mysql://"
Well, that's it for now. As always, if you have any tips or ideas, please add a comment here.
BTW, as these "howto" and troubleshooting pages become complete, I will be contributing them to the official documentation.