diff --git a/lib/exe/css.php b/lib/exe/css.php
index 263d7ff0fb6ec16dea76679589f9b3cfa9f71976..f80e0af6d658d93375add47fa21f4572d316111b 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -135,7 +135,7 @@ function css_out(){
 
     // save cache file
     io_saveFile($cache,$css);
-    copy($cache,"compress.zlib://$cache.gz");
+    if(function_exists('gzopen')) io_saveFile("$cache.gz",$css);
 
     // finally send output
     if ($conf['gzip_output']) {
diff --git a/lib/exe/js.php b/lib/exe/js.php
index f79023c49fc896c23de2f9fc98ec39a22476fcaf..42190eac7eb1ec9c5db1c29511c46f96f4dc136c 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -127,7 +127,7 @@ function js_out(){
 
     // save cache file
     io_saveFile($cache,$js);
-    copy($cache,"compress.zlib://$cache.gz");
+    if(function_exists('gzopen')) io_saveFile("$cache.gz",$js);
 
     // finally send output
     if ($conf['gzip_output']) {