if you get 'could not create the file pointer' on the fopen then it can't create the file, so that is the first thing you need to figure out.
the main reason, usually, for not creating the file is the user running php not having permissions to write to the directory. Some hosts may not allow this but usually they will as long as you are in your own site's directories.
The more common issue with creating files is people aren't using the path they think they are, so...
you have to make sure that the path you pass to the fopen function is the correct path to where you want to create the file on the server, this has little or no bearing on the web path that you would see in the browser. Most often you to find the correct path by using ssh to log in to your server, sometimes you can also get this path from an ftp/scp client as well.
if/when you get a positive response from fopen then you can move onto messing with the fwrite, most of the time as long as you are passing a good pointer to fwrite then it will have no issues writing.
also, those tests you ran on fopen/fwrite/fclose aren't quite what phranque meant, more like the one in your last post where you have the function execute and test the return values from the function.
even for me to see the output of the path variables, I can only hazard a guess on where your files might be located based on what I see normally. You would need to compare the output from your script with where the path physically points to by looking on your server.