- ZipArchive не установлен в xampp?
- 1 ответ
- How to Enable ZIP Extension for PHP on Linux — Ubuntu — ZIP.SO — PHP.INI — Efront — XAMPP/LAMPP
- Apache Friends Support Forum
- Re: Install php_zip extension
- Re: Install php_zip extension
- ZipArchive not installed in xampp?
- Answer by Charlee Lowe
- Answer by Abdiel Rich
- Answer by Margot Burns
- Answer by Teagan Noble
ZipArchive не установлен в xampp?
У меня есть новейшая версия XAMPP и php версии 5.6.3, но я не могу использовать ZipArchive. Я загрузил php_zip.dll и поместил его в ext dir, я добавил расширение = php_zip.dll, но после сброса сервера у меня есть потепление: «Модуль» zip «уже загружен» Я все еще вижу ошибку: ZipArchive не найден. с помощью:
Fatal error: Class 'Att\Controller\ZipArchive' not found in .
zip и ZipArchive — это две разные вещи. zip (обычно) ссылается на расширение «zip» phps, которое ZipArchive (обычно) ссылается на расширение PECL, основанное на zip.
Хорошо, я понимаю, но это потепление появилось после того, как я добавил extension = php_zip.dll в php.ini ( php.net/manual/en/zip.installation.php ). Итак, как я могу использовать ZipArchive?
Я предполагаю, что предупреждение (и отклонение) библиотеки, которую вы добавили, является результатом того факта, что расширение zip уже присутствует в вашем php. Возможно встроенный (время компиляции) или расположенный где-то еще. Вы должны убедиться в этом, используя знаменитую phpinfo() .
О ZipArchive: не уверен, в чем проблема, на самом деле. В соответствии с документацией он включен в PHP 5> = 5.2.0 и PECL zip> = 1.1.0. Давайте попробуем отследить вещи. Что вы подразумеваете под «Я не могу использовать ZipArchive»? Что вы пробовали? Откуда эта ошибка? Вы можете опубликовать это полностью? Пожалуйста, добавьте эту информацию к самому вопросу, а не здесь, в комментариях. Для этого есть кнопка edit под вопросом.
ОК, спасибо за дополнительную информацию. Я разместил ответ ниже, учитывая это. Надеюсь, что это поможет решить вашу проблему!
1 ответ
Хорошо, учитывая добавленную вами дополнительную информацию по моему предложению в комментарии, теперь все становится яснее. Похоже, здесь у вас проблема с Att\Controller\ZipArchive : php пытается найти класс Att\Controller\ZipArchive , а не класс ZipArchive . Вероятно, это происходит потому, что вы пытаетесь использовать класс внутри сценария с именами. В этом случае php будет считать все имена классов локальными для общего пространства имен, как это было объявлено в начале скрипта, если только они не указаны с конкретной ссылкой на пространство имен.
Попробуйте сделать имя класса ссылкой на глобальное пространство имен явно. Поэтому вместо
(Обратите внимание на обратную косую черту ( \ ) перед именем класса. Также вы можете отбросить пустые скобки, завершающие ее, поскольку они пусты.)
Теперь php попытается найти класс под названием «ZipArchive» в глобальном пространстве имен ( \ ) и (надеюсь) успешно. Это общий эффект пространства имен в php и не имеет ничего общего с конкретным классом, который вы пытаетесь использовать,
How to Enable ZIP Extension for PHP on Linux — Ubuntu — ZIP.SO — PHP.INI — Efront — XAMPP/LAMPP
That contains Apache 2.4.3, MySQL 5.5.27, and PHP 5.4.7.
Follow instructions on the site (All it takes is just download and unzip into /opt/lampp. It’s pre-compiled).
For Apache, you might want to update the root directory of the http server to «/opt/lampp» (edit /opt/lampp/etc/httpd.conf and make sure the following path in the file is correct ServerRoot «/opt/lampp»).
Enable zip extension for php with apache by:
1- Un-commenting zip.so in /opt/lampp/etc/php.ini. (The latest version of XAMPP, as of this article, is compiled with zip support for PHP but you need to follow the few steps mentioned here to enable it and make it work).
2- Un-commenting and updating the path of the extension_dir in php.ini (extension_dir = «/opt/lampp/lib/php/extensions/no-debug-non-zts-20100525»)
3- Downloading zip.so into the Extension Dir.
You can download the modified php.ini, httpd.conf and the zip.so described above here:
Stop and start XAMPP
/opt/lampp/lampp stop
/opt/lampp/lampp start
Now you can download efront and unzip into /opt/lampp/efront..
If you find this section helpful, please send us a note to Mike@bostonIT.com so I can keep on adding quality hands-on articles.
Edit my.cnf. Change localhost to server ip instead of 127.0.0.1
Grant permissions to computers that need access to MySql. For example, to access mysql from two computers with IP addresses 192.168.1.5 and 192.168.1.7 and with user = root and password = password1, do the following:
$ mysql -u root -p
Enter password:
mysql> GRANT ALL ON *.* to root@’192.168.1.5′ IDENTIFIED BY ‘password1 ‘;
mysql> GRANT ALL ON *.* to root@’192.168.1.7′ IDENTIFIED BY ‘password1’;
Then stop and start XAMPP.
If you find this article helpful, please click to like our facebook page below so we can keep on adding quality hands-on articles.
Apache Friends Support Forum
I understand how to do it on a windows machine but am having trouble with the OSX version.
by glitzi85 » 10. November 2008 14:28
If you really want the zip extension yould would have to recompile PHP if it is not included yet. Maybe it would be easier to use the PECL Extension.
by vincentc » 20. November 2008 10:23
I have the same problem. The zip is not activated, but when i look at the installation, the directive —with-zip was defined.
I use the version 0.7.4 of Xampp for Mac. With the previous release, 0.7.3, i haven’t the problem «ZipArchive not found».
I try to install the pecl package via «pecl install zip» but fails with something like «autoconf not found» and PHPize failed.
I think i will try to reinstall 0.7.3 soon to verify the problem.
Is there anyone who can help us ? Is this a bug from Xampp 0.7.4 ? Please help.
Re: Install php_zip extension
by vincentc » 06. December 2008 15:48
I have some answers on the net. You must install:
— XCode from Apple with the default installation. The program will install autoconf, autoheader. in «/usr/bin».
— Xampp developper package with command line «tar xvfpz xampp-macosx-0.7.4-dev.tar.gz -C /Applications/xampp»
After that, all errors gone except one : «ERROR: `phpize’ failed»
Here is what i try to install a pecl package:
Code: Select all sudo sh /Applications/xampp/xamppfiles/bin/pecl install tidy
Password:
downloading tidy-1.2.tgz .
Starting to download tidy-1.2.tgz (9,602 bytes)
. done: 9,602 bytes
3 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
ERROR: `phpize’ failed
Anyone has an idea to help me succeeded to install pecl extensions ? Please, help !
Re: Install php_zip extension
by vincentc » 07. December 2008 18:19
YEEEEEEESSSSSSSSSSSSS ! FINALLY IT WORKS .
After 3 days of trying, installing, reinstalling, googling.
I’ve try this one post : viewtopic.php?t=31294 with the sources of php 5.2.7. The timeS i try it doesn’t worked. I’ve install macports after that, and try many other things that did’nt work too. I finally try a last one already with the post and it succeeded. And i don’t know why.
Here is my command lines to compile PHP :
‘./configure’ ‘—prefix=/Applications/xampp/xamppfiles’ ‘—program-suffix=-5.2.7’ ‘—libdir=/Applications/xampp/xamppfiles/lib/php/php5’ ‘—includedir=/Applications/xampp/xamppfiles/include/php/php5’ ‘—with-apxs2=/Applications/xampp/xamppfiles/bin/apxs’ ‘—with-config-file-path=/Applications/xampp/etc’ ‘—with-mysql=/Applications/xampp/xamppfiles’ ‘—disable-debug’ ‘—enable-bcmath’ ‘—enable-calendar’ ‘—enable-ctype’ ‘—enable-dbase’ ‘—enable-discard-path’ ‘—enable-exif’ ‘—enable-filepro’ ‘—enable-force-cgi-redirect’ ‘—enable-ftp’ ‘—enable-gd-imgstrttf’ ‘—enable-gd-native-ttf’ ‘—with-ttf’ ‘—enable-magic-quotes’ ‘—enable-memory-limit’ ‘—enable-safe-mode’ ‘—enable-shmop’ ‘—enable-sigchild’ ‘—enable-sysvsem’ ‘—enable-sysvshm’ ‘—enable-track-vars’ ‘—enable-trans-sid’ ‘—enable-wddx’ ‘—enable-yp’ ‘—with-ftp’ ‘—with-ncurses=/Applications/xampp/xamppfiles’ ‘—with-gdbm=/Applications/xampp/xamppfiles’ ‘—with-jpeg-dir=/Applications/xampp/xamppfiles’ ‘—with-png-dir=/Applications/xampp/xamppfiles’ ‘—with-freetype-dir=/Applications/xampp/xamppfiles’ ‘—without-xpm’ ‘—with-zlib=yes’ ‘—with-zlib-dir=/Applications/xampp/xamppfiles’ ‘—with-openssl=/Applications/xampp/xamppfiles’ ‘—with-expat-dir=/Applications/xampp/xamppfiles’ ‘—enable-xslt=/Applications/xampp/xamppfiles’ ‘—with-xsl=/Applications/xampp/xamppfiles’ ‘—enable-dom’ ‘—with-ldap=/Applications/xampp/xamppfiles’ ‘—with-gd=/Applications/xampp/xamppfiles’ ‘—with-mysql-sock=/Applications/xampp/xamppfiles/var/mysql/mysql.sock’ ‘—with-mcrypt=/Applications/xampp/xamppfiles’ ‘—with-mhash=/Applications/xampp/xamppfiles’ ‘—enable-sockets’ ‘—with-curl=/Applications/xampp/xamppfiles’ ‘—enable-mbregex’ ‘—enable-zend-multibyte’ ‘—enable-zip’ ‘—with-libxml-dir=/Applications/xampp/xamppfiles’ ‘—enable-soap’ ‘—enable-pcntl’ ‘—enable-dbx’ ‘—with-mysqli=/Applications/xampp/xamppfiles/bin/mysql_config’ ‘—with-bz2=/Applications/xampp/xamppfiles’ ‘—with-ming=shared,/Applications/xampp/xamppfiles’ ‘—with-pear=/Applications/xampp/xamppfiles/lib/php/pear’ ‘—with-mssql=/Applications/xampp/xamppfiles’ ‘—with-imap-dir=/Applications/xampp/xamppfiles’ ‘—with-imap=/Applications/xampp/xamppfiles’ ‘—enable-mbstring=all’ ‘—with-pgsql=shared,/Applications/xampp/xamppfiles’ ‘—with-gettext=/Applications/xampp/xamppfiles’ ‘—with-tidy’ ‘—with-iconv=/Applications/xampp/xamppfiles’
I’ve not install pdo. But you can test it with ‘—with-pdo-mysql=/Applications/xampp/xamppfiles’.
Good luck for you
ZipArchive not installed in xampp?
OK, given the additional information you added upon my suggestion in the comment things become more clear now. This looks like you have a namespacing issue here: php tries to locate the class Att\Controller\ZipArchive, not the class ZipArchive. This is probably the case because you try to use the class inside a namespaced script. In that case php will assume all class names as local to the general namespace as declared at the beginning of the script unless they are noted with a specific namespace reference. , How do keep pee from splattering from the toilet all around the basin and on the floor on old toilets that are really low and have deep water? ,Now php will try to locate a class called «ZipArchive» in the global namespace (\) and (hopefully) succeed. This is a general effect of namespacing in php and has nothing to do with the specific class you are trying to use. ,I have newest version of XAMPP and php version 5.6.3, but I can’t use ZipArchive. I’ve downloaded php_zip.dll and placed it in ext dir, I’ve added extension=php_zip.dll but after server reset I have warming :
Try makeing the class name to reference the global namespace explicitly. So instead of
Answer by Charlee Lowe
Answer by Abdiel Rich
Note: If you choose a root directory C:\ as target, you must not start setup_xampp.bat.,Use the «XAMPP Control Panel» for additional tasks, like starting/stopping Apache, MySQL, FileZilla and Mercury or installing these as services.,XAMPP is extracting to the subdirectory C:\xampp below the selected target directory.,Now start the file setup_xampp.bat, to adjust the XAMPP configuration to your system.
Type in one of the following URLs in your favourite web browser:
Answer by Margot Burns
PHP ships with the extensions most useful to the majority of developers. They are called «core» extensions. , Compiling shared PECL extensions with the pecl command ,Installation of PECL extensions, Installing a PHP extension on Windows
drive:\\path\to\php\executable\php.exe -i
Answer by Teagan Noble
just wanted to tryout grav on my own pc (maui linux) — but cant get it to work. I just,extracted + moved the folder to /var/www/html/grav,opened localhost in a browser and opened the /grav folder,I don’t need to change owner rights for my grav folder on my linux mint pc.
Trying to enable php-zip i did:
php --ini Configuration File (php.ini) Path: /etc/php/7.0/cli Loaded Configuration File: /etc/php/7.0/cli/php.ini Scan for additional .ini files in: /etc/php/7.0/cli/conf.d Additional .ini files parsed: /etc/php/7.0/cli/conf.d/10-opcache.ini, /etc/php/7.0/cli/conf.d/10-pdo.ini, /etc/php/7.0/cli/conf.d/15-xml.ini, /etc/php/7.0/cli/conf.d/20-apcu.ini, /etc/php/7.0/cli/conf.d/20-calendar.ini, /etc/php/7.0/cli/conf.d/20-ctype.ini, /etc/php/7.0/cli/conf.d/20-curl.ini, /etc/php/7.0/cli/conf.d/20-dom.ini, /etc/php/7.0/cli/conf.d/20-exif.ini, /etc/php/7.0/cli/conf.d/20-fileinfo.ini, /etc/php/7.0/cli/conf.d/20-ftp.ini, /etc/php/7.0/cli/conf.d/20-gd.ini, /etc/php/7.0/cli/conf.d/20-gettext.ini, /etc/php/7.0/cli/conf.d/20-iconv.ini, /etc/php/7.0/cli/conf.d/20-json.ini, /etc/php/7.0/cli/conf.d/20-mbstring.ini, /etc/php/7.0/cli/conf.d/20-phar.ini, /etc/php/7.0/cli/conf.d/20-posix.ini, /etc/php/7.0/cli/conf.d/20-readline.ini, /etc/php/7.0/cli/conf.d/20-shmop.ini, /etc/php/7.0/cli/conf.d/20-simplexml.ini, /etc/php/7.0/cli/conf.d/20-sockets.ini, /etc/php/7.0/cli/conf.d/20-sysvmsg.ini, /etc/php/7.0/cli/conf.d/20-sysvsem.ini, /etc/php/7.0/cli/conf.d/20-sysvshm.ini, /etc/php/7.0/cli/conf.d/20-tokenizer.ini, /etc/php/7.0/cli/conf.d/20-wddx.ini, /etc/php/7.0/cli/conf.d/20-xmlreader.ini, /etc/php/7.0/cli/conf.d/20-xmlwriter.ini, /etc/php/7.0/cli/conf.d/20-xsl.ini