[英]How to upgrade libxml to a specific version in Linux for php?
I need to upgrade the libxml library without recompiling php. 我需要升级libxml库而不重新编译php。 Tried the following steps:
尝试了以下步骤:
ftp://xmlsoft.org/libxml2/
(.tar.gz file) ftp://xmlsoft.org/libxml2/
下载所需版本(.tar.gz文件) .tar.gz
file and "cd" command to enter to that folder (eg: libxml2-2.9.5) .tar.gz
文件和“ cd”命令以进入该文件夹(例如:libxml2-2.9.5) Then executed following commands 然后执行以下命令
./configure make sudo make install
All success, but still the php -I | grep libxml
一切成功,但仍然是
php -I | grep libxml
php -I | grep libxml
is showing the old version only. php -I | grep libxml
仅显示旧版本。 Please help. 请帮忙。
You are mixing between the Library and the PHP Extension, PHP Extension is just a wrapper for the library to be able to use it in your PHP code. 您在库和PHP扩展之间混合使用,PHP扩展只是库的包装,以便能够在您的PHP代码中使用它。
So compiling a library does not means that you can use it as an extension for PHP, You will still need to compile a new version from the extension and use the new version of the library with it. 因此,编译库并不意味着您可以将其用作PHP的扩展,您仍将需要从该扩展中 编译新版本并与之一起使用该库的新版本。
To upgrade your extension to a specific library version often you will need to compile it from source, the problem with libxml is that it is bundled with PHP by default. 要将扩展升级到特定的库版本,通常需要从源代码进行编译,而libxml的问题是默认情况下它与PHP捆绑在一起。
The optional --with-libxml-dir directive is used to specify the location of libxml on the system that PHP is being compiled on, otherwise only the default locations are scanned.
可选的--with-libxml-dir指令用于指定libxml在要编译PHP的系统上的位置,否则仅扫描默认位置。
So you may need to recompile a new PHP version from source, and pass the new compiled bin for the new version of libxml to it just like what had been mentioned in the manual :- 因此,您可能需要从源代码重新编译新的PHP版本,并将新版本的libxml的新编译的bin传递给它,就像手册中提到的一样:
./configure .... --with-libxml-dir=/path/to/libxml
Instead of recompiling a new version of PHP and lose all of your current extensions configurations, you may try only recompiling xml extension from source and override the current extension as follows: 您可以尝试仅从源代码重新编译xml扩展名并覆盖当前扩展名,而不是重新编译新版本的PHP并丢失所有当前扩展名配置,而无需执行以下操作:
clone a new version of PHP: 克隆新版本的PHP:
git clone git@github.com:php/php-src.git
cd php-src/ext/libxml
git checkout YOUR_INSTALLED_PHP_VERSION
phpize
./configure --with-libxml-dir=/path/to/libxml
make
make install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.