PDA

View Full Version : recompiling php with --enable-zip parameter



shw
11-13-2008, 01:32 PM
Today I tried to install the eFront LMS (http://www.efrontlearning.net). The install failed because the zip facility was missing. On investingating this matter I discover that we can add zip to php by recompiling with the enable-zip parameter (http://www.php.net/manual/en/zip.installation.php).

If I understand things properly it is not a big deal to add a parameter to php. The php.net instructions (http://se.php.net/manual/en/install.unix.apache2.php) suggest that only steps 10, 11, 12 need to be followed, and that only a restart of php is needed rather than a recompile.

That sounds good! Trouble is that the files on the vps seem to be located differently to the guidelines from php.net. I can't even find the right place to run the ./configure --help command.

I am sure this is quite an easy matter to sort out, but I am terribly cautious about changing files above root and would appreciate it if someone could give me some advice.

Actually, I have missed the zip facility on the westhost vps after using both tar and zip on our cpanel setup, so I think this is a good opportunity to find out how to add it - and other parameters.

Simon

wildjokerdesign
11-14-2008, 07:27 AM
We are not able to access ./configure for PHP. This is something controlled by WestHost. It looks like eFront is for windows based systems so it may be you'll run into other problems.

shw
11-15-2008, 04:08 PM
Thank you once again Wildjoker. eFront comes with both installations for Windows and Linux, so that is not a problem.

I was certainly not happy about fiddling with php so am not at all surprised that westhost has denied us this opportunity - even on our own vps. On the other hand, this then means that we are unable to add ANY php parameter not included in the initial setup.

I will put in a ticket to support to see if they can help. I will also inform efrontlearning of this difficulty. It should be something they can sort out themselves. Other LMSs such as Moodle (http://www.moodle.org) also use zip files. Moodle have obviously managed to include this in their own coding.

Thanks again.

Simon

wildjokerdesign
11-16-2008, 07:18 AM
Simon,

It would be great if there was some way we could have access to ./configure for PHP so we could change what is enabled by default. If you find a work around I would love to know about it. :)

Shawn

mamos
11-20-2008, 08:19 AM
Dear Simon,

You can install this via the pecl command in php. Open up a shell and run this command:


pecl install zip

Once you have run that, edit the file located at /etc/php.ini and where you see the other extension=mod.so lines and add this line:


extension=zip.so

Save the file then simply restart your account using the "Restart Account" Link within Site Manager.

shw
11-21-2008, 05:49 AM
Thank you support, that worked fine.:)

I then wondered about this pecl command. Is it for installing php extensions?
I have previously had problems loading the ming extension (that Shawn solved), so I tried pecl install ming - but that didn't work.

I looked on php.net for information about pecl but got no hits. I presume that pecl is an in house command. Does it do anything else that might be useful for us to know about?

Simon

wildjokerdesign
11-21-2008, 11:49 AM
Here is a link to the PECL site: http://pecl.php.net/ No it is not an in house command. This link may also be useful to you: http://us3.php.net/manual/en/install.pecl.php

If you are in an SSH session you can type the following command for brief help on usage:

pecl help

ming is not available via pecl that I can tell although it is listed as a module. I think perhaps it is still under development.

shw
11-22-2008, 03:56 AM
Thank you Shawn, the links were interesting and useful.

Although my problems are now solved - I have installed both the zip and ming extensions - I will continue with this for a bit since others may be interested in adding php extensions via pecl.

I looked at

pecl help
and then

pecl list-all
This gives a list of 15 packages that I presumed would be installable. One of the packages is zip. Ming is not included.

Just to test things out I decided the oggvorbis extension might be useful to have, so I tried

pecl install oggvorbis
This is what I got back

/$ pecl install oggvorbis
Package "oggvorbis" Version "0.2" does not have REST xml available
Cannot initialize 'channel://pecl.php.net/oggvorbis', invalid or missing package file
Package "channel://pecl.php.net/oggvorbis" is not valid
install failed
I think I will bother support again to find out which extensions we can install via pecl.

The main reason for my continuing with this is the amount of time the pecl install saved us. Compare the couple of minutes installing the zip extension via pecl with the hours of fiddling about trying to install the ming extension and it becomes very clear that the more php extensions we can add via pecl the better!

Simon

wildjokerdesign
11-22-2008, 06:49 AM
Something else we have available to us is PEAR: http://pear.php.net/ Actually PECL and PEAR are very similar and are kind of tied together.

shw
11-23-2008, 03:57 AM
I have now been in contact with support and asked if they can give us some clearer guidelines on using pecl for php extensions. pecl is clearly very useful and saves a lot of time, so will probably be of interest for others.

As a footnote to this post about zips, I then thought it would be useful to be able to create zips directly on our vps. Here follows a couple of useful links:

The first link talks a bit about pecl and the zip extension and gives some examples:
devzone.zend.com (http://devzone.zend.com/article/2105-Dynamically-Creating-Compressed-Zip-Archives-With-PHP)

I downloaded and tested PclZip from here:
PhpConcept (http://www.phpconcept.net/pclzip/index.en.php)

After downloading the file I made a php to create a zip using the following code (with a couple of changes) from the user manual (http://www.phpconcept.net/pclzip/man/en/index.php?methods-create).


<?php
include_once('pclzip.lib.php');
$archive = new PclZip('archive.zip');
$v_list = $archive->create('file.txt,data/text.txt,folder');
if ($v_list == 0) {
die("Error : ".$archive->errorInfo(true));
}
?>

It worked just fine!

Simon

tptompkins
08-19-2010, 01:01 PM
I just performed this command as instructed and received the following error:



[username][~]$ pecl install zip
downloading zip-1.10.2.tgz ...
Starting to download zip-1.10.2.tgz (236,912 bytes)
.................................................d one: 236,912 bytes
61 source files, building
WARNING: php_bin /usr/local/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

ERROR: `phpize' failed


Please advise on how we can get this resolved. Thank you!

Tommy

wildjokerdesign
08-22-2010, 06:33 AM
Is this on a WestHost account? Most the references I could find on this error where related to Windows servers and we WestHost does not offer Windows servers.