Get current PHP executable from within script?

前端 未结 10 1978
一个人的身影
一个人的身影 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条回答
  •  萌比男神i
    2020-12-03 21:35

    Is there anything useful in $_ENV?

    The SHELL environment variable on Unix has the path to the shell that's currently running. If you add #!/path/to/php to the top of your PHP file, make it executable and run the file directly, does $_ENV['SHELL'] contain /path/to/php?

提交回复
热议问题