【问题标题】:How to get the PHP version from the source code?如何从源代码中获取 PHP 版本?
【发布时间】:2012-04-22 02:16:49
【问题描述】:

我正在尝试创建一个 downloads the latest version of PHP from Github(主分支)的 bash 脚本并安装它。

我想用我正在下载的版本创建一个文件夹(例如 /path/to/php/5.4.0),但我在源代码中找不到任何文件说“嘿,我是 XXX 版本PHP”。看看下面我的简单代码的作用:

url="https://github.com/php/php-src/tarball/master"
curl -L $url > php-temp.tar.gz
tar -zxf php-temp.tar.gz
cd php-php-src*

我想 cat|grep 一些 VERSION 或 README 文件,但我在其中找不到任何对 PHP 版本的引用。

有没有人知道哪里有这个信息的文件?

【问题讨论】:

    标签: php shell


    【解决方案1】:

    文件main/php_version.h 包含您要查找的信息:

    例如(https://github.com/php/php-src/blob/master/main/php_version.h):

    /* automatically generated by configure */
    /* edit configure.in to change version number */
    #define PHP_MAJOR_VERSION 5
    #define PHP_MINOR_VERSION 5
    #define PHP_RELEASE_VERSION 0
    #define PHP_EXTRA_VERSION "-dev"
    #define PHP_VERSION "5.5.0-dev"
    #define PHP_VERSION_ID 50500
    

    【讨论】:

    • 谢谢回复,但是为什么是5.5呢?不应该是5.4的最后一个版本吗?
    • 他们已经在 php 5.5 上工作了,如果你去 PHP-5.4 分支,它会显示 5.4
    猜你喜欢
    • 1970-01-01
    • 2017-07-18
    • 1970-01-01
    • 1970-01-01
    • 2018-02-04
    • 1970-01-01
    • 2016-06-18
    • 2016-07-19
    相关资源
    最近更新 更多