apt-get安装的php默认就自带了zlib了吧:
php-m|grepzlib查看zlib是否已经加载
php--ini查看当前使用的配置文件(没有配置文件,PHP也是能正常工作的)
其实这些在phpinfo里都能看到的吧.
今天关机了,明天一早把phpinfo发给你老看一下
<aclass='referer'target='_blank'>@eechen这里是phar的信息
<aname="module_Phar"rel="nofollow">Phar
<tableborder="0"cellpadding="3">Phar:PHPArchivesupportenabledPharEXTversion2.0.1PharAPIversion1.1.1SVNrevision$Id:ec823514107160b7e6fabc519594012657a2db91$Phar-basedphararchivesenabledTar-basedphararchivesenabledZIP-basedphararchivesenabledgzipcompressiondisabled(installext/zlib)bzip2compressiondisabled(installpecl/bz2)OpenSSLsupportdisabled(installext/openssl)
sudoapt-getinstallphp5-cli
/usr/bin/php5-r'print_r(get_declared_classes());'|grepZipArchive
[122]=>ZipArchive
我这边是能找到这个已经声明的类的.
好我试试,刚才我扯了一下可能是和配置路径损坏有关系,我默认安装ubuntu的apt-get了5.3,后来手工升级成5.4这下子好像就乱了.我看到ConfigurationFile(php.ini)Path这类变量和实际的并不相同无语啊
已经找到原因了,还是升级编译php出的纰漏,
这些选项不是默认的,真恶心啊...
重新编译加上去安装之后就没问题了
感谢<aclass='referer'target='_blank'>@eechen
回复<aclass='referer'target='_blank'>@eechen:是的,我以为很多选项都是默认的...杯具了http://php.net/manual/en/zip.installation.php你应该是在configure时漏了--enable-zip,所以没有ZipArchive这个类.<atarget="_blank"rel="nofollow">https://wiki.php.net/phpng
这是鸟哥他们开发测试用的编译配置,覆盖了大多数常用的功能,你参考一下:
./configure<br>--prefix=$HOME/tmp/usr<br>--with-config-file-path=$HOME/tmp/usr/etc<br>--enable-mbstring<br>--enable-zip<br>--enable-bcmath<br>--enable-pcntl<br>--enable-ftp<br>--enable-exif<br>--enable-calendar<br>--enable-sysvmsg<br>--enable-sysvsem<br>--enable-sysvshm<br>--enable-wddx<br>--with-curl<br>--with-mcrypt<br>--with-iconv<br>--with-gmp<br>--with-pspell<br>--with-gd<br>--with-jpeg-dir=/usr<br>--with-png-dir=/usr<br>--with-zlib-dir=/usr<br>--with-xpm-dir=/usr<br>--with-freetype-dir=/usr<br>--with-t1lib=/usr<br>--enable-gd-native-ttf<br>--enable-gd-jis-conv<br>--with-openssl<br>--with-mysql=/usr<br>--with-pdo-mysql=/usr<br>--with-gettext=/usr<br>--with-zlib=/usr<br>--with-bz2=/usr<br>--with-recode=/usr<br>--with-mysqli=/usr/bin/mysql_config
根据https://wiki.php.net/phpng总结得出的新的编译参数:
sudoapt-getinstall<br>build-essential<br>autoconf<br>libtool<br>re2c<br>libxml2-dev<br>openssl<br>libcurl4-openssl-dev<br>libbz2-dev<br>libjpeg-dev<br>libpng12-dev<br>libfreetype6-dev<br>libldap2-dev<br>libmcrypt-dev<br>libmysqlclient-dev<br>libxslt1-dev<br>libxt-dev<br>libpcre3-dev<br>libxpm-dev<br>libt1-dev<br>libgmp-dev<br>libpspell-dev<br>librecode-dev
libxml2-dev依赖libxml2,安装开发包libxml2-dev时会自动安装上共享库libxml2,其他开发包也类似.
sudoln-s/usr/include/x86_64-linux-gnu/gmp.h/usr/include/gmp.h或者--with-gmp=/usr/include/x86_64-linux-gnu
./configure<br>--prefix=/png/php/phpng<br>--enable-fpm<br>--enable-opcache<br>--enable-pdo<br>--enable-sockets<br>--enable-exif<br>--enable-soap<br>--enable-ftp<br>--enable-wddx<br>--enable-pcntl<br>--enable-soap<br>--enable-bcmath<br>--enable-mbstring<br>--enable-dba<br>--enable-gd-native-ttf<br>--enable-gd-jis-conv<br>--enable-zip<br>--enable-calendar<br>--enable-shmop<br>--enable-sysvmsg<br>--enable-sysvsem<br>--enable-sysvshm<br>--with-mysql<br>--with-mysqli<br>--with-pdo-mysql<br>--with-pdo-sqlite<br>--with-iconv<br>--with-gmp<br>--with-pspell<br>--with-gettext<br>--with-xmlrpc<br>--with-openssl<br>--with-mhash<br>--with-mcrypt<br>--with-xsl<br>--with-curl<br>--with-pcre-regex<br>--with-gd<br>--with-jpeg-dir=/usr<br>--with-png-dir=/usr<br>--with-zlib-dir=/usr<br>--with-xpm-dir=/usr<br>--with-freetype-dir=/usr<br>--with-t1lib=/usr<br>--with-gettext=/usr<br>--with-zlib=/usr<br>--with-bz2=/usr<br>--with-recode=/usr<br>--with-ldap<br>--with-pear<br>--with-fpm-user=png<br>--with-fpm-group=png<br>--with-apxs2=/png/httpd/2.4.10/bin/apxs感谢!