I was trying to use ZipArchive, but i got an error:
Fatal error: Class 'ZipArchive' not foundThen I started to Google how to install zip extension on my Ubuntu Apache 2 server. I have PHP version 5.3.10 and in configuration it says, that zip is enabled. This information you can get with these 2 simple commands:
php -iphp -vI have tried to use zip extension in php file with this line:
$zip = new ZipArchive();I was trying to install zip with:
pecl install zipThen i got error from the title and used this as a solution:
apt-get install libpcre3-devAfter this i used pecl install zip again and it went smoothly:
Build process completed successfully
Installing '/usr/lib/php5/20090626+lfs/zip.so'
install ok: channel://pecl.php.net/zip-1.10.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=zip.so" to php.ini
The problem was that even after apache server restart with
/etc/init.d/apache2 restartZipArchive class was still missing. I have already edited my php.ini file and added there
extension=zip.soYou can find your php.ini file with this command:
find / -name 'php.ini'To find anything about zip extension in your php.ini file, you can use this command:
grep zip /etc/php5/apache2/php.iniJust make sure, that path to the file is as it is in your server. You found it with find command already.
So no I've tried to add full path to zip.so file to the php.ini:
extension=/usr/lib/php5/20090626+lfs/zip.so
restart the server once again
/etc/init.d/apache2 restartand it worked like a charm!
No comments:
Post a Comment
You can ask IT questions in comments!