These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Missing the ZipArchive class on the new forum.
Hi,
I had a problem last week with a missing element from my php that one was "php-xml".
I think I am also missing the ZipArchive class.
The php manual says that no installation is necessary as it is part of the php core but when I run this in my php script:
$zip = new ZipArchive; $zip->open("$page"); $zip->extractTo('./'); $zip->close(); echo "Ok!";
I get this error:
Fatal error: Class 'ZipArchive' not found in /home/guru54gt5/public_html/sys/convert_xml.php on line 70
So I guess that means that I need to add it to my php somehow ?
Is this another yum command ?
Sounds like your application requires the Zip PECL extension:
http://pecl.php.net/package/zip
You can install that with the "pecl" command.
-Eric
Thanks, I also just noticed this in the php manual:
PHP 5.2.0 and later Linux systems
In order to use these functions you must compile PHP with zip support by using the --enable-zip configure option.
When using the pecl install it should automatically download the latest version and install it right? So to use the pecl command do I just login with putty and at the command line type:
$ pecl install zip
No yum install ? Is that dollar sign supposed to be there ?
Would much appreciate the clarification :)
Yup, just type "pecl install zip" and it'll install the Zip extension. Only the core PHP modules are packaged as RPM's, the various PECL extensions will need to be installed manually like above if your app needs them.
-Eric
I tried it and I got this message:
WARNING: channel "pecl.php.net" has updated its protocols, use "channel-update pecl.php.net" to update pecl/zip requires PEAR Installer (version >= 1.7.0), installed version is 1.4.9 No valid packages found install failed
What should I do now ?
you could do what it says..
run: channel-update pecl.php.net and try again.
Thanks - but I was not sure of how to run the update.
So I just entered that but got an error.
Last login: Tue Oct 27 13:41:44 2009 from 78.167.110.4 channel-update pecl php.net -bash: channel-update: command not found
As the error said - I think it needs the PEAR Installer changed to version >= 1.7.0 That is the bit that I don't know how to do.
Is upgrading this PEAR installer a yum command ?
The parameters they gave you were meant to be passed into the pecl command.
Try running it this way:
pecl channel-update pecl.php.net
OK
I did that.
result:
[root@heavyhoster ~]# pecl channel-update pecl.php.net Retrieving channel.xml from remote server Update of Channel "pecl.php.net" succeeded
I then tried running "pecl instal zip"
And I still get this result:
[root@heavyhoster ~]# pecl install zip pecl/zip requires PEAR Installer (version >= 1.7.0), installed version is 1.4.9 No valid packages found install failed [root@heavyhoster ~]#
Looks like it still needs the PEAR Installer changed to version >= 1.7.0
That is the bit that I don't know how to do.
While I'm not a pecl/pear guru, doing some Googling, it looks like you just need to upgrade the PEAR package with something like:
pear upgrade pear
I tried it: [root@heavyhoster ~]# pear upgrade pear WARNING: channel "pear.php.net" has updated its protocols, use "channel-update pear.php.net" to update pear/PEAR dependency package "pear/Structures_Graph" downloaded version 1.0.3 is not the recommended version 1.0.2, but may be compatible, use --force to install pear/Archive_Tar requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9 downloading Structures_Graph-1.0.3.tgz ... Starting to download Structures_Graph-1.0.3.tgz (30,191 bytes) .........done: 30,191 bytes downloading Console_Getopt-1.2.3.tgz ... Starting to download Console_Getopt-1.2.3.tgz (4,011 bytes) ...done: 4,011 bytes downloading XML_Util-1.2.1.tgz ... Starting to download XML_Util-1.2.1.tgz (17,729 bytes) ...done: 17,729 bytes upgrade ok: channel://pear.php.net/XML_Util-1.2.1 upgrade ok: channel://pear.php.net/Console_Getopt-1.2.3 upgrade ok: channel://pear.php.net/Structures_Graph-1.0.3
Looked OK so: [root@heavyhoster ~]# pecl install zip pecl/zip requires PEAR Installer (version >= 1.7.0), installed version is 1.4.9 No valid packages found install failed
Now I tried the channel update: [root@heavyhoster ~]# pear channel-update pear.php.net Retrieving channel.xml from remote server Update of Channel "pear.php.net" succeeded
Again looked good, but:
[root@heavyhoster ~]# pecl install zip pecl/zip requires PEAR Installer (version >= 1.7.0), installed version is 1.4.9 No valid packages found install failed [root@heavyhoster ~]#
I googled it and found this: http://divorcewithadifference.com/index.php?command=remote-info&pkg=pear...
but it doesn't tell me how to upgrade and the warnings were putting me off :(
Any more ideas ?
I contacted the physical server supplier (rackmounted)
They have sorted out the problem. It certainly was not an easy upgrade, this is what they wrote:
Sorry for the delay, there were quite a few things that needed to be done before the zip package could be installed. Pear needed to be updated first to 1.5.4 and then 1.9.0. After that you were missing "Development Tools" provided by yum. I tried to install the latest version for zip which is 1.10.2 but it has some issues compiling. I solved the dependency issues, but it still had compilation errors. So I reverted to an older version 1.8.10 which has compiled and installed successfully. If you have any questions please let us know.
Anyway - just wanted to let you know and thank you for looking into it.
I never know if these issues are due to upgrades that you would normally release in the upgrade packages or some other issue.
So long as it works, I am happy :)
Thanks.