如何详细在Centos7系统上安装php7的zip扩展?
- 内容介绍
- 文章标签
- 相关推荐
本文共计606个文字,预计阅读时间需要3分钟。
本章节为家庭用户介绍如何在CentOS 7下安装php7并配置zip扩展。以下是一步一步的安装方法:
1. 使用以下命令安装php7和相关开发包: yum install -y php-devel
2. 安装zip扩展: - 下载zip扩展源码包: wget http://pecl.php.net/get/zip-1.14.2.tgz - 解压源码包: tar -xzf zip-1.14.2.tgz - 进入zip扩展目录: cd zip-1.14.2 - 配置并编译安装zip扩展: ./configure --with-php-config=/usr/bin/php-config make make install
3. 重启Apache服务以使配置生效: systemctl restart httpd
安装完成后,您可以在phpinfo()函数中查看zip扩展是否已正确安装。如有需要,您可以通过以下链接参考更多详细信息和安装步骤:- PECL Zip扩展:[http://pecl.php.net/package/zip](http://pecl.php.net/package/zip)
希望这对您有所帮助!
本篇文章给大家介绍一下Centos7下php7安装zip扩展的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
安装:
yum install -y php-devel #用于编译 cd /usr/local/src wget pecl.php.net/get/zip-1.15.3.tgz tar -zxvf zip-1.15.3.tgz cd zip-1.15.3 phpize whereis php-config ./configure --with-php-config=/usr/bin/php-config
报错:configure: error: Please reinstall the libzip distribution。
最新版本请参考官网:nih.at/libzip/ ,libzip 需要 cmake 。
yum install -y cmake cd ../ yum remove libzip wget libzip.org/download/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0.tar.gz mkdir build && cd build && /usr/local/bin/cmake .. && make && make install
又报错:
CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED): CMake 3.0.2 or higher is required. You are running version 2.8.12.2 -- Configuring incomplete, errors occurred!
cmake版本过低,需新版本。
yum remove cmake yum install -y cmake3 cmake -version
OK,cmake环境版本升级完毕。
然后再编译 zip 。
cd ../zip-1.15.3 ./configure --with-php-config=/usr/bin/php-config make make install
安装过程中若出现
fatal error: zipconf.h: No such file or directory
使用命令:
find /usr/local -iname 'zipconf.h' ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include
然后再执行一遍安装即可。最后用命令查看有没有zip.so文件。
ls /usr/lib64/php/modules/
修改 /etc/php.ini :
zlib.output_compression = On extension=/usr/lib64/php/modules/zip.so
重启 apache:
service www.longshidata.com/pages/government.html,感恩 】
本文共计606个文字,预计阅读时间需要3分钟。
本章节为家庭用户介绍如何在CentOS 7下安装php7并配置zip扩展。以下是一步一步的安装方法:
1. 使用以下命令安装php7和相关开发包: yum install -y php-devel
2. 安装zip扩展: - 下载zip扩展源码包: wget http://pecl.php.net/get/zip-1.14.2.tgz - 解压源码包: tar -xzf zip-1.14.2.tgz - 进入zip扩展目录: cd zip-1.14.2 - 配置并编译安装zip扩展: ./configure --with-php-config=/usr/bin/php-config make make install
3. 重启Apache服务以使配置生效: systemctl restart httpd
安装完成后,您可以在phpinfo()函数中查看zip扩展是否已正确安装。如有需要,您可以通过以下链接参考更多详细信息和安装步骤:- PECL Zip扩展:[http://pecl.php.net/package/zip](http://pecl.php.net/package/zip)
希望这对您有所帮助!
本篇文章给大家介绍一下Centos7下php7安装zip扩展的方法。有一定的参考价值,有需要的朋友可以参考一下,希望对大家有所帮助。
安装:
yum install -y php-devel #用于编译 cd /usr/local/src wget pecl.php.net/get/zip-1.15.3.tgz tar -zxvf zip-1.15.3.tgz cd zip-1.15.3 phpize whereis php-config ./configure --with-php-config=/usr/bin/php-config
报错:configure: error: Please reinstall the libzip distribution。
最新版本请参考官网:nih.at/libzip/ ,libzip 需要 cmake 。
yum install -y cmake cd ../ yum remove libzip wget libzip.org/download/libzip-1.2.0.tar.gz tar -zxvf libzip-1.2.0.tar.gz cd libzip-1.2.0.tar.gz mkdir build && cd build && /usr/local/bin/cmake .. && make && make install
又报错:
CMake Error at CMakeLists.txt:4 (CMAKE_MINIMUM_REQUIRED): CMake 3.0.2 or higher is required. You are running version 2.8.12.2 -- Configuring incomplete, errors occurred!
cmake版本过低,需新版本。
yum remove cmake yum install -y cmake3 cmake -version
OK,cmake环境版本升级完毕。
然后再编译 zip 。
cd ../zip-1.15.3 ./configure --with-php-config=/usr/bin/php-config make make install
安装过程中若出现
fatal error: zipconf.h: No such file or directory
使用命令:
find /usr/local -iname 'zipconf.h' ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include
然后再执行一遍安装即可。最后用命令查看有没有zip.so文件。
ls /usr/lib64/php/modules/
修改 /etc/php.ini :
zlib.output_compression = On extension=/usr/lib64/php/modules/zip.so
重启 apache:
service www.longshidata.com/pages/government.html,感恩 】

