Closed GoogleCodeExporter closed 9 years ago
I made a mistake on the title. Correction: Does not work WITHOUT bzip2
Original comment by twomuchw...@gmail.com
on 17 Oct 2010 at 11:20
Files inside MPQ archive compressed with bzip2 algorithm.
Try to add in your php.ini:
extension=bz2.so
or add in your .htaccess:
<IfModule mod_php5.c>
php_value extension bz2.so
</IfModule>
<IfModule mod_php4.c>
php_value extension bz2.so
</IfModule>
or use function inside your script:
dl('bz2.so');
If nothing worked, you can't read SC2Replay files on this host.
Original comment by ph3...@gmail.com
on 18 Oct 2010 at 5:21
Attach the .so file
Original comment by twomuchw...@gmail.com
on 18 Oct 2010 at 10:51
Each operating system has it's own specific compiled version of the bz2.so.
It's not something that is part of PHP or this package...
Original comment by hostmas...@gab-ev.de
on 21 Oct 2010 at 7:37
Where can I find it for Debian?
Original comment by twomuchw...@gmail.com
on 21 Oct 2010 at 10:57
it's a built-in module in libapache2-mod-php5
Original comment by zsol.z...@gmail.com
on 21 Oct 2010 at 7:32
Either I am doing it wrong, or this does not work with DreamHost, and I am
pretty sure it is the latter.
Original comment by twomuchw...@gmail.com
on 21 Oct 2010 at 11:39
You can always do a phpinfo(); to see if it is installed.
Took me awhile to find a host that had it out of the box. The host was
Bluehost.
Original comment by kfletche...@gmail.com
on 23 Oct 2010 at 7:15
As has been said in the comments, some of the files inside the replay files are
compressed with the bzip2 algorithm. If your host does not have the bzip2
module installed, you will either have to find an implementation of it in pure
php or get the host to install the module.
As this is not a problem with the parser, I am closing the issue ticket.
Original comment by lauri.vi...@gmail.com
on 24 Oct 2010 at 7:26
I'm using Dreamhost and I was able to write a quick hack to make it work, since
Dreamhost does support command-line bzip2. As it's a hack, I didn't bother
making the code look good :P Note this is EXTREMELY BAD code as it's super
inefficient because it will create and destroy temp files a ton using up I/O
and uses exec which is also bad form. But... it works! And I was able to write
it in under 2 minutes.
Modify the mpqfile.php and add an include/require to a PHP file. I called mine
hack.lib. Make sure you specify the full path of course.
Search through the file and look for:
function bzip2_decompress($string) {
if (function_exists("bzdecompress")){
$tmp = bzdecompress($string);
and change it to:
function bzip2_decompress($string) {
if (function_exists("bzdecompresshack")){
$tmp = bzdecompresshack($string);
Then in your new library which you specified above, use the following code:
function bzdecompresshack($data) {
$file = "";
$fh = fopen("$file.bz2", w);
fwrite($fh, $data);
exec("/bin/bzip2 -d $file.bz2");
$return = file_get_contents("$file");
unlink("$file");
return($return);
}
replace $file = "" with whatever path you want to create your temp file in.
I'm sure there is a more elegant hack out there and even ways to improve this
(I can think of a couple myself). But this got the job done, and I have other
things to work on...
Original comment by randomu...@gmail.com
on 13 Nov 2010 at 9:58
Original issue reported on code.google.com by
twomuchw...@gmail.com
on 17 Oct 2010 at 11:19