Maison  >  Questions et réponses  >  le corps du texte

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

我需要在Shell中获得最新PHP版本号,然后检查服务器是否需要升级。

比如 Apache 提供的下载是 http://www.apache.org/dist/httpd/ ,它将所有版本都列出来了,我可以通过elinks和awk轻松提取最新版本号,但是php要怎样做呢?

迷茫迷茫2749 Il y a quelques jours388

répondre à tous(2)je répondrai

  • PHP中文网

    PHP中文网2017-04-10 13:13:29

    你的意思是通过awk去解析html,然后parse版本号吗?

    http://www.php.net/downloads.php 这个链接里有 Current stable

    curl http://www.php.net/downloads.php|grep "Current stable" |awk '{print $3}'

    可以获取最新版本号
    然后通过 php -v 可以获得php的版本号。

    répondre
    0
  • 阿神

    阿神2017-04-10 13:13:29

    感谢!问题已解决。

    répondre
    0
  • Annulerrépondre