php安装目录下的php-config文件的用处分析

php安装目录下的php-config文件的用处分析

该文件在安装扩展的时候会用到。下面是来自php官网的文件,我们先给出一个安装php扩展的案例:

./configure --with-php-config=/usr/local/php746/bin/php-config  #该选项必须加进去否则容易在make的时候报错make: *** [mbstring.lo] Error 1,尤其是pc中有多个php版本的时候,你安装哪个版本的扩展,就制定哪个版本中的php-config文件,这个文件存储的是已经安装的php版本的一些安装信息,比如php的安装目录(--prefix),扩展目录,版本号等多个选项。比如在安装扩展的时候,会直接将扩展文件生成到默认的对应版本的扩展目录。检测已经安装的php的版本号与你要安装的扩展的版本号是否匹配等,这个配置文件很重要,不仅仅是用于安装扩展中。

------------------下面是官网原文-----------------------------

php-config

php-config is a simple shell script for obtaining information about the installed PHP configuration.

When compiling extensions, if you have multiple PHP versions installed, you may specify for which installation you'd like to build by using the--with-php-config option during configuration, specifying the path of the respective php-config script.

The list of command line options provided by the php-config script can be queried anytime by running php-config with the -h switch:

Usage: /usr/local/bin/php-config [OPTION]
Options:
  --prefix            [...]
  --includes          [...]
  --ldflags           [...]
  --libs              [...]
  --extension-dir     [...]
  --include-dir       [...]
  --php-binary        [...]
  --php-sapis         [...]
  --configure-options [...]
  --version           [...]
  --vernum            [...]

 

Command line options
Option Description
--prefix Directory prefix where PHP is installed, e.g. /usr/local
--includes List of -I options with all include files
--ldflags LD Flags which PHP was compiled with
--libs Extra libraries which PHP was compiled with
--extension-dir Directory where extensions are searched by default
--include-dir Directory prefix where header files are installed by default
--php-binary Full path to php CLI or CGI binary
--php-sapis Show all SAPI modules available
--configure-options Configure options to recreate configuration of current PHP installation
--version PHP version
--vernum PHP version as integer

你可能感兴趣的:(php,linux)