1

I need to compress/decompress in php and compress/decompress it in C++ I know about gzinflate/gzdeflate, bzcompress/bzdecompress and etc. - it's all one method, just with different wrappers But I need any another method, with C++ there's no problem, but I have no access to extensions on PHP, so I can use only inbuilt package Can I access using installed libraries?

Installed extensions:

[0] => Core [1] => date [2] => ereg [3] => libxml [4] => openssl [5] => pcre
[6] => zlib [7] => bz2 [8] => calendar [9] => ctype [10] => curl [11] => hash
[12] => fileinfo [13] => filter [14] => gettext [15] => gmp [16] => SPL
[17] => iconv [18] => json [19] => session [20] => standard
[21] => Reflection [22] => Phar [23] => SimpleXML [24] => mbstring
[25] => tokenizer [26] => cgi-fcgi [27] => bcmath [28] => dba
[29] => dom [30] => ftp [31] => gd [32] => imap [33] => exif
[34] => mcrypt [35] => mysqli [36] => mysql [37] => mysqlnd
[38] => PDO [39] => pdo_mysql [40] => sqlite3 [41] => pdo_sqlite
[42] => posix [43] => soap [44] => sockets [45] => xmlreader
[46] => xmlrpc [47] => xml [48] => xmlwriter [49] => xsl
[50] => zip [51] => intl [52] => rar [53] => hostprotect
[54] => mhash [55] => ionCube Loader [56] => Zend Guard Loader

1 Answer 1

1

I can see you have PHP zip extension. Hence you can use bzip2, which will return a compressed version of the input data. It is not a wrapper of gzip, It is entirely different compression algorithm.

Eg:

 <?php    
  $filename = "/tmp/testfile.bz2";
  $str = "This is a test string.\n";

  $bz = bzopen($filename, "w");
  bzwrite($bz, $str);
  bzclose($bz);  
?>

Full Reference Bzip2 Functions

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for reply Gzip is a wrapper over deflate Unfortunately I need another algorithm
Thank you, I thought that bzip2 is wrapper too, but it's another algorithm I'll tag your message right Thank you again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.