Jump to content

How to enable ZIP support in PHP 5.1.6?


adrianTNT

Recommended Posts

Hello.

 

My host updated PHP to 5.1.6 and now zip functions like zip_open do not work, it says undefined function or something similar, "zip enabled" doesn't show on phpinfo() eider.

 

Is there an easyer way to use the zip functions? Maybe by downloading and including the libraries by include lines?

Or only by recompiling the php? (this one sounds complicated).

 

What can I do?

Link to comment
Share on other sites

Hi Ace, this is the code in the script, the error is:

Fatal error: Call to undefined function zip_open() in ...

// upload and unpack the zip of additional files
if(isset($_FILES["zip_box"]['name']) and $_FILES["zip_box"]['name']!=''){
	$dir = 'flash_files/'.$listing_id.'/';
	$zip = zip_open($_FILES["zip_box"]['tmp_name']);
	while($zip_entry = zip_read($zip)) {
		$entry = zip_entry_open($zip,$zip_entry);
		$filename = zip_entry_name($zip_entry);
		$target_dir = $dir.substr($filename,0,strrpos($filename,'/'));
		$filesize = zip_entry_filesize($zip_entry);
		if (is_dir($target_dir) || mkdir($target_dir)) {
			if ($filesize > 0) {
				$contents = zip_entry_read($zip_entry, $filesize);
				file_put_contents($dir.$filename,$contents);
				echo $dir.$filename.'<br />';

				// if there are php, asp files then rename them by adding _safe in the name
				if(strpos(strtolower($dir.$filename),'.php') == (strlen($dir.$filename)-4)){
					rename($dir.$filename,$dir.$filename.'_safe');
				}
				if(strpos(strtolower($dir.$filename),'.asp') == (strlen($dir.$filename)-4)){
					rename($dir.$filename,$dir.$filename.'_safe');
				}
				if(strpos(strtolower($dir.$filename),'.cgi') == (strlen($dir.$filename)-4)){
					rename($dir.$filename,$dir.$filename.'_safe');
				}
				if(strpos(strtolower($dir.$filename),'.js') == (strlen($dir.$filename)-3)){
					rename($dir.$filename,$dir.$filename.'_safe');
				}
				if(strpos(strtolower($dir.$filename),'.jsp') == (strlen($dir.$filename)-4)){
					rename($dir.$filename,$dir.$filename.'_safe');
				}


			}
		}
	}
}

I have previous server phpinfo and new server phpinfo, the new server is the one with problems, on the new server phpinfo I do not see the part "Zip Support Enabled".

Thanks.

Link to comment
Share on other sites

My host updated PHP to 5.1.6 and now zip functions like zip_open do not work

You will have to ask your host to add support for the zip extension. Unless you have root access, you cannot do this yourself.

I have root access and the host (GoDaddy) doesn't want to enable the zips since is a dedicated server and they say is my responsibility; I expected the server to have basic functions available, but whatever.

So how can I fix this as root?

Link to comment
Share on other sites

What distro aare you using?

Im not sure what it means, is this the operating system version?

 

It is Fedora 6

I also have plesk 8.2.1 installed (in case there is an easy way by plesk).

This info is from my cpanel:

 

Version psa v8.2.1_build82070918.10 os_FedoraCore 6

OS Linux 2.6.22.9-61.fc6

 

Thanks.

Link to comment
Share on other sites

You have a dedicted server and don't know what OS it is? Scary. :)

I didn't knew what 'distro' means, sure i know what an OS is :P

 

Anyway ... I first asked godaddy to enable the zip on server, then they asked for permission to access the server and day later they told me that I need to do it myself, when I tried I could not access the server by SSH anymore, it disconnected me *before asking for password. After 4-5 more emails they said 4 Ips including my own is banned from accessing the SSH and in order to unban my IP I should login by SSH and edit some system files. :))

Or I could pay them $75/ half hour and they could edit the files to unban me.

 

So in order to access server by SSH you must first login by SSH and edit some files. LOL LOL.

 

Thanks for the fast replies, I will try the commands as soon as they let me on the server.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.