简体   繁体   English

从源代码安装时,PHP扩展在哪里?

[英]Where are PHP extensions when installing from source?

When I try to run a PHP scripts I get the following errors: 当我尝试运行PHP脚本时,出现以下错误:

Warning: PHP Startup: Unable to load dynamic library '/home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so' - /home/user/php-5.4.28/installdir/include/php/ext/php_bz2.so: cannot open shared object file: No such file or directory in Unknown on line 0

php.ini: php.ini:

extension_dir = "/home/user/php-5.4.28/installdir/include/php/ext"

Content at extension_dir path: extension_dir路径中的内容:

~/php-5.4.28/installdir/include/php/ext$ ls
date  ereg    gd    iconv  libxml    mysqli   pcre  session  sqlite3   xml
dom   filter  hash  json   mbstring  mysqlnd  pdo   spl      standard

Where do I locate the extension? 我在哪里找到扩展名? I have installed PHP from source. 我已经从源代码安装了PHP。 All the errors and phpinfo() can be seen here on JSBin 所有错误和phpinfo()都可以在JSBin上看到

You don't have to locate the extension. 您不必找到扩展名。 You have to recompile PHP passing the option --with-bz2 to the ./configure script. 您必须重新编译PHP,将选项--with-bz2传递给./configure脚本。 Bzip2 support is not enabled by default as official documentation says. 官方文档所述 ,默认情况下未启用Bzip2支持。

./configure --with-bz2

Keep in mind that in order to compile PHP with this extension you need development headers and/or libraries. 请记住,为了使用此扩展编译PHP,您需要开发标头和/或库。 If they are missing ./configure will fail saying what's missing. 如果缺少它们,。 ./configure将无法说出丢失的内容。 If this will happen simply use your package manager (apt, yum or zypper - distro dependent) to install required packages and retry. 如果发生这种情况,只需使用您的软件包管理器(apt,yum或zypper-依赖于发行版)安装所需的软件包并重试。

It's also likely that your PHP apps are using other extensions. 您的PHP应用程序也可能正在使用其他扩展。 The procedure is exactly the same. 步骤完全相同。 You just add more options. 您只需添加更多选项。 Let's say that curl is also needed, then: 假设还需要卷曲,那么:

./configure --with-bz2 --with-curl

will work - again more headers and packages needed. 将工作-再次需要更多的标题和包。

Remember to always use all the options you need as the results of former compilations are overwritten. 切记始终使用所需的所有选项,因为以前的编译结果会被覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM