Automator Macos Macos Monterey中的php shell脚本不再起作用
Macos Monterey不仅支持Automator中的PHP。
您可以从终端运行PHP而不会出错(如果通过Brew安装),但是在A “运行Shell Script”中从Automator运行PHP脚本,给出了错误
php:找不到命令
php:在终端中
which php
,在/usr/locar/local/bin/php
中运行。
有趣的是,较新的快捷方式应用程序支持PHP脚本。有什么想法如何使自动机再次与PHP一起使用?
MacOS Monterey no only seems to support PHP within Automator.
You can run PHP from the Terminal without error (if installed via Brew) but running PHP scripts from Automator in a "Run Shell Script" gives the error
php: command not found
In the Terminal, running
which php
Results in /usr/local/bin/php
.
Interestingly the newer Shortcuts app supports PHP scripts. Any ideas how to get Automator working with PHP again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
之所以发生这种情况,是因为您的PHP途径在
/user/local/bin
中,并且它不再是Automator使用的PATH
的一部分。在未修改的Automator “运行shell脚本” 步骤中,
path
变量包含,因此,修复它的简单方法是添加
/usr/usr/usr/local/bin < /code>到中的
路径
“运行shell脚本” 。为了做到这一点,您必须在上述任务中添加一条第一行,该任务包括:
从那里开始,Automator将能够像以前一样正确找到PHP二进制文件。
有关
path
变量的更多信息及其在linux和unix中的意义(Mac OS是一个类似于Unix的分布),可以找到在这里。This happened because your path to PHP is in
/user/local/bin
and that it is not part of thePATH
used by Automator anymore, as it seems.In an unmodified Automator "Run Shell Script" step, the
PATH
variable containsSo, the simple way to fix it is to add
/usr/local/bin
to thePATH
in your "Run Shell Script".In order to do that, you juste have to add a first line in the said task that would consist of:
From there on, Automator will be able to find the PHP binary correctly, as it was before.
More information on what is the
PATH
variable and what it does mean in Linux and Unix (Mac OS is a Unix-like distribution) can be found here.