Get current PHP executable from within script?

前端 未结 10 1965
一个人的身影
一个人的身影 2020-12-03 21:08

I want to run a PHP cli program from within PHP cli. On some machines where this will run, both php4 and php5 are installed. If I run the outer program as

         


        
10条回答
  •  执笔经年
    2020-12-03 21:27

    I know this question is a bit old, but it came up while looking for a shorter way of doing this.

    Unfortunately I can't find a shorter way, but this works pretty well and is multi OS/PHP version compatible.

    $lookIn could probably be extended to include more common locations.

    https://gist.github.com/cjsewell/39b60065ae2af677ceb1

    Hope it helps someone

提交回复
热议问题