[乐意黎原创] Centos下载安装PHP7.4.10(7.4.11)时开启ZIP模块的入坑与填坑记

Posted 打杂人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[乐意黎原创] Centos下载安装PHP7.4.10(7.4.11)时开启ZIP模块的入坑与填坑记相关的知识,希望对你有一定的参考价值。

 php 7.4 的 安装配置  

yum install libxml2-devel bzip2 bzip2-devel curl-devel libjpeg-devel libpng libpng-devel freetype-devel libxslt-devel libzip-devel -y
./configure \\
--prefix=/usr/local/php \\
--with-config-file-path=/etc \\
--enable-fpm \\
--with-fpm-user=nginx \\
--with-fpm-group=nginx \\
--enable-inline-optimization \\
--disable-debug \\
--disable-rpath \\
--enable-shared \\
--enable-soap \\
--with-xmlrpc \\
--with-openssl \\
--with-mcrypt \\
--with-pcre-regex \\
--with-sqlite3 \\
--with-zlib \\
--enable-bcmath \\
--with-iconv \\
--with-kerberos \\
--with-libdir=lib64 \\
--with-bz2 \\
--enable-calendar \\
--with-curl \\
--with-cdb \\
--enable-dom \\
--enable-exif \\
--enable-fileinfo \\
--enable-filter \\
--with-pcre-dir \\
--enable-ftp \\
--enable-gd \\
--with-openssl-dir \\
--with-jpeg-dir \\
--with-png-dir \\
--with-freetype-dir \\
--enable-gd-native-ttf \\
--enable-gd-jis-conv \\
--with-gettext \\
--with-gmp \\
--with-mhash \\
--enable-json \\
--enable-mbstring \\
--enable-mbregex \\
--enable-mbregex-backtrack \\
--with-libmbfl \\
--with-onig \\
--enable-pdo \\
--with-mysqli=mysqlnd \\
--with-pdo-mysql=mysqlnd \\
--with-zlib-dir \\
--with-pdo-sqlite \\
--with-readline \\
--enable-session \\
--enable-shmop \\
--enable-simplexml \\
--enable-sockets \\
--enable-sysvmsg \\
--enable-sysvsem \\
--enable-sysvshm \\
--enable-wddx \\
--with-libxml-dir \\
--with-xsl \\
--with-zip \\
--enable-xml \\
--enable-mysqlnd-compression-support \\
--without-pear \\
--enable-opcache \\
--enable-pcntl

 

PHP Version 7.4.10

SystemLinux aerchi 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017 x86_64
Build DateSep 23 2020 15:02:02
Configure Command'./configure' '--prefix=/usr/local/php' '--with-config-file-path=/etc' '--enable-fpm' '--with-fpm-user=nginx' '--with-fpm-group=nginx' '--enable-inline-optimization' '--disable-debug' '--disable-rpath' '--enable-shared' '--enable-soap' '--with-xmlrpc' '--with-openssl' '--with-mcrypt' '--with-pcre-regex' '--with-sqlite3' '--with-zlib' '--enable-bcmath' '--with-iconv' '--with-kerberos' '--with-libdir=lib64' '--with-bz2' '--enable-calendar' '--with-curl' '--with-cdb' '--enable-dom' '--enable-exif' '--enable-fileinfo' '--enable-filter' '--with-pcre-dir' '--enable-ftp' '--enable-gd' '--with-openssl-dir' '--with-jpeg-dir' '--with-png-dir' '--with-freetype-dir' '--enable-gd-native-ttf' '--enable-gd-jis-conv' '--with-gettext' '--with-gmp' '--with-mhash' '--enable-json' '--enable-mbstring' '--enable-mbregex' '--enable-mbregex-backtrack' '--with-libmbfl' '--with-onig' '--enable-pdo' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-zlib-dir' '--with-pdo-sqlite' '--with-readline' '--enable-session' '--enable-shmop' '--enable-simplexml' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-wddx' '--with-libxml-dir' '--with-xsl' '--with-zip' '--enable-xml' '--enable-mysqlnd-compression-support' '--with-pear' '--enable-opcache' '--enable-pcntl' 'PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig'
Server APIFPM/FastCGI
Virtual Directory Supportdisabled
Configuration File (php.ini) Path/etc
Loaded Configuration File/etc/php.ini



PHP 7.4.10安装时抛

error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found

解决方法:
安装libzip (在此之前可能需要安装  cmake, 参考附)

wget https://libzip.org/download/libzip-1.7.3.tar.gz
tar -zxvf libzip-1.7.3.tar.gz
cd libzip-1.7.3
mkdir build
cd build
cmake .. 
make &&make install

//添加
export PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig/"

附: 安装cmake 

//期间可能需要安装 cmake
wget https://cmake.org/files/v3.15/cmake-3.15.4.tar.gz
tar zxvf cmake-3.15.4.tar.gz
cd cmake-3.9.2/
./configure
make &&make install

//查看是否安装成功
/usr/local/bin/cmake --version

cmake version 3.15.4
CMake suite maintained and supported by Kitware (kitware.com/cmake).

 复制文件

cp php.ini-production /usr/local/php/etc/php.ini

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

 


问题1:启动php-fpm时,出现Starting php-fpm … failed

解决方法:检查启动脚本 /etc/init.d/php-fpm 和配置文件 /usr/local/php/etc/php-fpm.conf 中的pid路径是否一致。


问题2:php-V  显示 -bash: php: command not found

在profile环境变量里加入

vim /etc/profile

export NODE_HOME=/usr/local/node
export PATH=$NODE_HOME/bin:$PATH
export NODE_PATH=$NODE_HOME/lib/node_modules:$PATH
export PATH=/usr/local/php/bin:/usr/local/php/sbin:$PATH

 

一. 查看 pkg_config_path 环境变量 命令

root@aerchi:~# echo $PKG_CONFIG_PATH

二、查看自己的 pkgconfig 路径在哪里?

root@aerchi: find / -name pkgconfig

三、设置 pkg_config_path 环境变量 方法

1、如果你只是想加上某库的pkg,只需要用如下命令:

root@aerchi: export PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig

 

2、如果你想覆盖掉原来的pkg,可选择用此方法。因为PKG_CONFIG_LIBDIR的优先级比 PKG_CONFIG_PATH 高,所以会覆盖PKG_CONFIG_PATH的设置。

root@aerchi:~# export PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig/

root@aerchi:~# export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/opt/libxml2/lib/pkgconfig"

 

也可以使用如下命令,注意一定要放在PKG_CONFIG_PATH的前面,这样才能首先读取。

root@aerchi:~# export PKG_CONFIG_PATH=/usr/local/libzip/lib64/pkgconfig/:$PKG_CONFIG_PATH

 


PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
 

在 /usr/local/src 目录下, 下载 go-pear.phar
wget  http://pear.php.net/go-pear.phar 

cp /usr/local/src/go-pear.phar /usr/local/php/bin
[root@aerchi src]# cd usr/local/php/bin
[root@aerchi bin]# php go-pear.phar
Below is a suggested file layout for your new PEAR installation.  To
change individual locations, type the number in front of the
directory.  Type 'all' to change all of them or simply press Enter to
accept these locations.

 1. Installation base ($prefix)                   : /usr/local/php
 2. Temporary directory for processing            : /tmp/pear/install
 3. Temporary directory for downloads             : /tmp/pear/install
 4. Binaries directory                            : /usr/local/php/bin
 5. PHP code directory ($php_dir)                 : /usr/local/php/lib/php
 6. Documentation directory                       : /usr/local/php/docs
 7. Data directory                                : /usr/local/php/data
 8. User-modifiable configuration files directory : /usr/local/php/cfg
 9. Public Web Files directory                    : /usr/local/php/www
10. System manual pages directory                 : /usr/local/php/man
11. Tests directory                               : /usr/local/php/tests
12. Name of configuration file                    : /usr/local/php/etc/pear.conf

1-12, 'all' or Enter to continue: Enter
  

[root@aerchi bin]# php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
zip
zlib
[Zend Modules]

 Python.h No such file or directory问题解决

1.可以先查看一下含python-devel的包

yum search python | grep python-devel
  • 1

2.64位安装python-devel.x86_64,32位安装python-devel.i686,我这里安装:

sudo yum install python-devel.x86_64

 “Package libxml-2.0 was not found in the pkg-config search path”

1. 下载 libxml-2.0

wget ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz

then after unpacking and moving into the folder:

tar -zxvf libxml2-2.9.2.tar.gz

cd libxml2-2.9.2

 

./configure --prefix=/usr/local --disable-static --with-history 

make && make install
  • deb: libxml2-dev (Debian, Ubuntu, etc)
  • rpm: libxml2-devel (Fedora, CentOS, RHEL)
  • csw: libxml2_dev (Solaris)

 

but 7.4 is not 7.3
7.4 relies on pkg-config

configure: error: Cannot find ldap libraries in /usr/lib

解决办法:

cp -frp /usr/lib64/libldap* /usr/lib/

yum install openldap openldap-* -y


其它问题, 请参考: https://blog.csdn.net/kina100/article/details/106949987/

参考链接: 
R devtools fails as “Package libxml-2.0 was not found in the pkg-config search path”
https://stackoverflow.com/questions/31797524/r-devtools-fails-as-package-libxml-2-0-was-not-found-in-the-pkg-config-search-p

 

乐意黎

2020-09-23

以上是关于[乐意黎原创] Centos下载安装PHP7.4.10(7.4.11)时开启ZIP模块的入坑与填坑记的主要内容,如果未能解决你的问题,请参考以下文章

[乐意黎原创]Centos ftp连接时抛vftpuser.db: file size not a multiple of the pagesize 530 Login incorrect.的解决办法

[乐意黎]Centos安装nginx1.18后, 将nginx制作成服务设置为自启动

[乐意黎]Centos安装nginx1.18后, 将nginx制作成服务设置为自启动

[乐意黎原创]安装 Flutter时抛 “此时不应有 flutter_windows_1.17.5-stableflutterincache“的解决办法

[乐意黎原创] eclipse Kepler Selected SVN connector library is not available or cannot be loaded

[乐意黎原创] 百度统计这个坑爹货