PHP: How can I tweak PHPUnit to use a different PHP interpreter?

前端 未结 6 911
误落风尘
误落风尘 2021-01-04 13:31

My system has two PHP interpreters. One came bundled with the OS and the other I installed via the XAMPP package. All of my PHP extensions are applied to the XAMPP installat

6条回答
  •  误落风尘
    2021-01-04 14:17

    On Windows, this may be achieved using a similar approach to the ones mentioned in other replies.

    In your /path/to/composer/phpunit directory, open the phpunit file in an editor. The first line should look like this:

    #!/usr/bin/env php
    

    Simply download your desired version of PHP for Windows, place the contents of the ZIP file somewhere to your liking, and reference the fully quantified path to the php.exe file, instead of just php. Like so:

    #!/usr/bin/env /c/misc/php-5.5.9-nts-Win32-VC11-x86/php.exe
    

    In my case, I put it in /c/misc/php-5.5.9-nts-Win32-VC11-x86/, which corresponds to C:\misc\php-5.5.9-nts-Win32-VC11-x86\ using Windows path syntax.

    Remember to verify that the correct php.ini file is being used (php --ini or in a script file php_ini_loaded_file()).

提交回复
热议问题