[英]How do I run "php phpunit.phar" CLI from anywhere?
I just installed phpunit.phar and am trying to set it up.我刚刚安装了 phpunit.phar 并正在尝试设置它。 What I am trying to do is to put phpunit.phar in a path so that I can run it from anywhere directly from the php cli.
我想要做的是将 phpunit.phar 放在一个路径中,这样我就可以从任何地方直接从 php cli 运行它。 At this point, it is in my include_path and I can include it within a script from anywhere.
此时,它在我的 include_path 中,我可以从任何地方将它包含在脚本中。 But, what I think I need to do is run it from the cli "php phpunit.phar".
但是,我认为我需要做的是从 cli“php phpunit.phar”运行它。
Is this doable or is it even appropriate?这是可行的还是合适的?
I think that the phpunit.phar just need to be in your path variable.我认为 phpunit.phar 只需要在你的路径变量中。 Or write a small script which is located in /usr/bin with this content:
或者写一个位于 /usr/bin 中的小脚本,内容如下:
#!/bin/sh
php /path/to/phpunit.phar
if you are using windows如果您使用的是 Windows
%~dp0php.exe %~dp0pharcommand.phar %*
Now you can run on cmd prompt现在您可以在 cmd 提示符下运行
phpunit --v
This is no longer necesssary, according to http://phpunit.de/getting-started.html .根据http://phpunit.de/getting-started.html ,这不再是必需的。 You can simply rename phpunit.phar to phpunit, chmod it executable, and put it in your path (usually /usr/local/bin) and it should automatically detect the interpreter directive.
您可以简单地将 phpunit.phar 重命名为 phpunit,对其进行 chmod 可执行,并将其放入您的路径(通常是 /usr/local/bin),它应该会自动检测解释器指令。
You can run it from everywhere.你可以从任何地方运行它。 Just give the correct path:
只要给出正确的路径:
/usr/share/pear/exec/phpunit.phar -c app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.