I am on shared hosting, and I noticed the PHP does not include bzip2. It seems I would have to re-compile PHP inorder to use this. I don't think shared hosting allows this, so is there any alternative to my situation or bzip2?
views:
37answers:
1
+1
A:
If your host allows dl()
(I doubt it), you can dynamically load a shared extension.
Checklist for dl
:
dl
should not be listed indisable_functions
safe_mode
off- PHP < 5.3
enable_dl
On- Operating system (Win32 requires DLLs, Linux requires .so files)
- The extension should be available in the extension directory of PHP.
The best thing you can do is asking your host to enable bzip2 support, and otherwise search for an alternative. There are plenty hosts with bzip2 supported.
Lekensteyn
2010-10-17 07:08:10
I AM IN LUCK! It is enabled. How do I get the extension though? Do I have to download it from somewhere?
Doug
2010-10-17 07:09:53
What OS is your server running on? Win32 or Linux? Is the server running as module (Apache) or CGI? You can check that using `phpinfo()`, look for `System` and `Server API`.
Lekensteyn
2010-10-17 07:14:40
System: Linux and Server API: CGI/FastCGI
Doug
2010-10-17 07:16:53
Ok, and what distro is it? FreeBSD, Debian, CentOS, ...?
Lekensteyn
2010-10-17 07:18:56
How do I check?
Doug
2010-10-17 07:19:49
Just paste the full System line from phpinfo(). It should be noted there
Lekensteyn
2010-10-17 07:20:46
Found it. I used `cat /proc/version`. Debian.
Doug
2010-10-17 07:30:11
Debian 64 bits download: http://packages.debian.org/lenny/ia64/libbz2-1.0/download. Unpack it on your computer and upload `lib/libbz2.so.1` to `libbz2.so` on your server.
Lekensteyn
2010-10-17 07:30:57
Unpacked, where do I upload it to? Is this right? `dl("libbz2.so.1"); dl("libbz2.so.0"); dl("libbz2.so.0.4");`
Doug
2010-10-17 07:57:44
Oops, I missed this line: `This parameter is only the filename of the extension [...] The directory where the extension is loaded from depends on your platform`. Sorry for the confusion, but you really have to contact your hosting provider.
Lekensteyn
2010-10-17 08:33:38
Okay. I'll do that.
Doug
2010-10-17 09:07:00