The code chokes at fopen():

<?php 
  ini_set('display_errors',1);
  error_reporting(E_ALL);
  $fp = fopen("/path/to/file/some_file.txt","a") or die("can't open file");
  fwrite($fp,"some text");
  fclose($fp);
?>

And also the resulting web site states:

"Warning: fopen(/path/to/file/some_file.txt) [function.fopen]: unsuccessful to spread out stream: Permission refused in /var/www/html/test.php online 5 can't open file"

I attempted to experience using the file permissions, but with no success. I transformed the consumerOrteam with chown apache:apache some_file.txt and transformed permissions with chmod 755 some_file.txt. This is actually the relevant consequence of ls -l /path/to/file/:

-rwxr-xr-x 1 apache apache 0 Apr 12 04:16 some_file.txt

You are certain apache may be the user really running your PHP?`

And: make certain the apache user can achieve some_file.txt within the file system which it is not blocked by some access restriction on sites above some_file.txt.

Remember that even when Apache's been granted permissions to see the file, you might also need to grant Apache use of All the parent sites.

/path/to/file/
/path/to
/path

all have to grant Apache a minimum of 'Read' permission.

"a" means you need to append, exactly the same permissions for write are essential.

You'll need a minimum of 666 permissions to create by everyone. Or change file owner to server group (www-data on Ubuntu). And hang the needed permission.

Here's Permission calculator

If this doesn't helps, look into the safe_mode too.

Prior to going to repair a mistake, it might be nice to understand, which error to repair.
Add wrinkles towards the top of your script after which repeat the process

ini_set('display_errors',1);
error_reporting(E_ALL);

PHP will explain, what's the problem