Automator Macos Macos Monterey中的php shell脚本不再起作用

发布于 2025-01-23 04:07:27 字数 370 浏览 3 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断舍离 2025-01-30 04:07:27

之所以发生这种情况,是因为您的PHP途径在/user/local/bin中,并且它不再是Automator使用的PATH的一部分。

在未修改的Automator “运行shell脚本” 步骤中,path变量包含,

/usr/bin:/bin:/usr/sbin:/sbin

因此,修复它的简单方法是添加/usr/usr/usr/local/bin < /code>到中的路径“运行shell脚本”
为了做到这一点,您必须在上述任务中添加一条第一行,该任务包括:

PATH="/usr/local/bin:$PATH"

从那里开始,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 the PATH used by Automator anymore, as it seems.

In an unmodified Automator "Run Shell Script" step, the PATH variable contains

/usr/bin:/bin:/usr/sbin:/sbin

So, the simple way to fix it is to add /usr/local/bin to the PATH 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:

PATH="/usr/local/bin:$PATH"

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文