How can I gzip my JavaScript and CSS files?

I have a problem, I have to gzip a prototype Lib, but i totaly have no idea how to do this, where to start and how does it works. :)

I find some tutorials but that wasn't helpful...

So I have a folder with my JS Files:

/compressed/js/ 1.js 2.js 3.js

I'm calling these files for a test in this file

/compresses/index.php

<link rel="javascript" type="text/js" href="js/tabs.js" />
<link rel="javascript" type="text/js" href="js/fb.js" />

So what do I have to do? :)

Not able to open a file in php

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 the resulting web page says:

"Warning: fopen(/path/to/file/some_file.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/html/test.php on line 5 can't open file"

I tried to play with the file permissions, but to no avail. I changed the user/group with chown apache:apache some_file.txt and changed permissions with chmod 755 some_file.txt. Here is the relevant result of ls -l /path/to/file/:

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