Get current PHP executable from within script?

前端 未结 10 2002
一个人的身影
一个人的身影 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:32

    On my server I've php 5.3.14.

    I've found a predefined constant: PHP_BIN_DIR

    Then, supposing the file name of the executable file is always 'php', $php_cmd = PHP_BIN_DIR.'/php' point to my PHP executable file.

提交回复
热议问题