Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
WangYan
V2EX  ›  Linux

Shell中如何获得最新版本的PHP?

  •  
  •   WangYan ·
    wangyan · Sep 10, 2012 · 4421 views
    This topic created in 5169 days ago, the information mentioned may be changed or developed.
    我需要在Shell中获得最新PHP版本号,然后检查服务器是否需要升级。

    比如 Apache 提供的下载是 http://www.apache.org/dist/httpd/ ,它将所有版本都列出来了,我可以通过elinks和awk轻松提取最新版本号,但是php要怎样做呢?
    3 replies  •  1970-01-01 08:00:00 +08:00
    robhsiao
    robhsiao
    Sep 10, 2012
    1
    curl -s http://php.net/downloads.php | grep 'Current stable' | perl -nle 'print $1 if m/(\d+\.\d+\.\d+)/'
    WangYan
    WangYan
    OP
    Sep 10, 2012
    2
    感谢 @robhsiao

    是我愚钝了,没想到用curl。segmentfault.com 中的“大盗贼”给出了我更喜欢的答案。

    curl -s http://www.php.net/downloads.php |grep "Current stable" |awk '{print $3}'
    cute
    cute
    Sep 11, 2012
    3
    curl -s http://www.php.net/downloads.php|awk '/Current stable/{print $3}'
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1361 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 20:19 · PVG 04:19 · LAX 12:19 · JFK 15:19
    ♥ Do have faith in what you're doing.