「php-config」

php-config,该命令用于获取已经安装的PHP的配置及编译选项。该命令是一个SHELL脚本。

命令行语法格式

php-config [options]

如果没有指定[options],则会列出所有的配置选项。

命令支持的选项及含义

–prefix
PHP所安装的目录前缀。比如:/usr/local

–includes
编译时-I选项的参数列表,包含了所有的include文件。

–ldflags
PHP在编译时使用的链接标志。

–libs
PHP在编译时使用的额外库。

–man-dir
手册所在的路径。

–extension-dir
扩展搜索时的默认路径。

–include-dir
头文件的安装默认位置。

–php-binary
PHP的CLI或者CGI二进制文件的路径。

–php-sapis
显示所有可用的SAPI模块。

–configure-options
用于重建当前已安装PHP配置的配置选项。编译当前安装的PHP时使用的编译选项。

–version
PHP版本号。

–vernum
整数类型的PHP版本。

输出示例

在GNU/Linux中


在MacOSX中

#  /usr/local/opt/php@5.6/bin/php-config
Usage: /usr/local/opt/php@5.6/bin/php-config [OPTION]
Options:
  --prefix            [/usr/local/Cellar/php@5.6/5.6.35_1]*
  --includes          [-I/usr/local/Cellar/php@5.6/5.6.35_1/include/php -I/usr/local/Cellar/php@5.6/5.6.35_1/include/php/main -I/usr/local/Cellar/php@5.6/5.6.35_1/include/php/TSRM -I/usr/local/Cellar/php@5.6/5.6.35_1/include/php/Zend -I/usr/local/Cellar/php@5.6/5.6.35_1/include/php/ext -I/usr/local/Cellar/php@5.6/5.6.35_1/include/php/ext/date/lib]
  --ldflags           [ -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/jpeg/lib -L/usr/local/opt/libpng/lib -L/usr/local/opt/freetype/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/gmp/lib -L/usr/local/Cellar/icu4c/61.1/lib -L/usr/local/opt/mcrypt/lib -L/usr/local/opt/unixodbc/lib -L/usr/local/opt/freetds/lib -L/usr/local/Cellar/libpq/10.3/lib -L/usr/local/opt/aspell/lib -L/usr/local/Cellar/libzip/1.5.1/lib]
  --libs              [  -lcrypto -lssl -lcrypto -lzip -lz -lexslt -lresolv -ledit -lncurses -laspell -lpspell -lpq -lpq -lsybdb -lmcrypt -lltdl -lldap -llber -lstdc++ -liconv -liconv -lgmp -lintl -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lcrypto -lssl -lcrypto -lm  -lxml2 -lz -licucore -lm -lkrb5 -lcurl -lxml2 -lz -licucore -lm -lfreetype -licui18n -licuuc -licudata -licuio -lodbc -lodbc -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxslt -lxml2 -lz -licucore -lm ]
  --extension-dir     [/usr/local/Cellar/php@5.6/5.6.35_1/pecl/20131226]
  --include-dir       [/usr/local/Cellar/php@5.6/5.6.35_1/include/php]
  --man-dir           [/usr/local/Cellar/php@5.6/5.6.35_1/share/man]
  --php-binary        [/usr/local/Cellar/php@5.6/5.6.35_1/bin/php]
  --php-sapis         [ apache2handler cli fpm phpdbg cgi]
  --configure-options [--prefix=/usr/local/Cellar/php@5.6/5.6.35_1 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/5.6 --with-config-file-path=/usr/local/etc/php/5.6 --with-config-file-scan-dir=/usr/local/etc/php/5.6/conf.d --with-pear=/usr/local/Cellar/php@5.6/5.6.35_1/share/php@5.6/pear --enable-bcmath --enable-calendar --enable-dba --enable-exif --enable-ftp --enable-fpm --enable-intl --enable-mbregex --enable-mbstring --enable-mysqlnd --enable-opcache-file --enable-pcntl --enable-phpdbg --enable-phpdbg-webhelper --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --enable-zip --with-apxs2=/usr/local/opt/httpd/bin/apxs --with-bz2 --with-fpm-user=_www --with-fpm-group=_www --with-freetype-dir=/usr/local/opt/freetype --with-gd --with-gettext=/usr/local/opt/gettext --with-gmp=/usr/local/opt/gmp --with-icu-dir=/usr/local/opt/icu4c --with-jpeg-dir=/usr/local/opt/jpeg --with-kerberos --with-layout=GNU --with-ldap --with-ldap-sasl --with-libedit --with-libzip --with-mhash --with-mysql-sock=/tmp/mysql.sock --with-mysqli=mysqlnd --with-mysql=mysqlnd --with-mcrypt=/usr/local/opt/mcrypt --with-ndbm --with-openssl=/usr/local/opt/openssl --with-pdo-dblib=/usr/local/opt/freetds --with-pdo-mysql=mysqlnd --with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc --with-pdo-pgsql=/usr/local/opt/libpq --with-pgsql=/usr/local/opt/libpq --with-pic --with-png-dir=/usr/local/opt/libpng --with-pspell=/usr/local/opt/aspell --with-unixODBC=/usr/local/opt/unixodbc --with-webp-dir=/usr/local/opt/webp --with-xmlrpc --with-xsl --with-zlib --with-curl CC=clang CPPFLAGS=-DU_USING_ICU_NAMESPACE=1 CXX=clang++]
  --version           [5.6.35]
  --vernum            [50635]

相关文档

php(1)

参考文献

  • man 1 php-config, version 5.6.34