PHP command not found

When using the PHP statement in a procedure, the error at the bottom of the procedure window is:
PHP ERROR: sh: php: command not found

Using Terminal, I can enter

  php -v

and get the current version of PHP

What am I doing wrong?

I assume you have moved to macOS Monterey. Apple has removed PHP from Monterey, if you want to use it you will have to install it yourself.

I’m not sure what the current status of Python, Ruby and Perl are, but Apple announced several years ago that they were going to remove all of these scripting language, so if they are not already removed, they will be. I think this is unfortunate but Apple doesn’t consult me on these decisions.

This Google search links to many other web pages on this topic.

Yes I am on Monterey and yes, Apple did not include it. But I have installed it successfully and that is how I can type

php -v 

in Terminal and get the response of the version installed. Thus my PATH is also set correctly. (Apache is also running fine as is MySQL.)

And now what are your thoughts?

Panorama expects PHP to be installed at:


My guess would be that whatever tool you used to install PHP (Homebrew, perhaps?) installed it at a different location, and modified the shell configuration so that it would work with Panorama doesn’t know anything about how the shell is configured, so it doesn’t work. There is no supported way to change the location that Panorama expects to find the PHP tool. That will probably need to be reconsidered now that we can’t rely on Apple to have installed the tool in a particular place. For now, you’ll either need to move the PHP tool (I think you might be able to set up an alias, but I’m not sure about that) or modify the source code for the PHP statement in Panorama.

Adding a alias is not as easy or possible as it once was. Turning off SIP is not a problem but even then, the System volume is still using a cryptographic hash to verify if it has been altered in any way. There is a workaround to boot without SSV but I think that is a stretch for this situation. Read-only file system with Signed System Volume

Is there an equivalent to the Python solution?

secretglobal pythonPrefixLineTemplate
pythonPrefixLineTemplate = 

Or might a custom statement be more appropriate? If so, while the documentation on custom statements is a bit scarce, would it follow identically to custom functions?

Ok, good point.

Where did you get this solution? Did I post it at some point? I don’t remember. In any case, the PHP code is similar, so if the Python solution works, it should work for PHP also.

secretglobal phpPrefixLineTemplate
phpPrefixLineTemplate = "#!/some/where/else/php"

Please let me know if it does work, as that knowledge will save me some time when I work on issue #1209.

Local output

SecretGlobal phpPrefixLineTemplate
phpPrefixLineTemplate = "#!/Users/rameeti/homebrew/bin/php"

PHP |||php -v|||, output
Message output

PHP ERROR: sh: php: command not found

‘SecretGlobal’ not found…?

That would be odd in that it is being declared and then assigned a value immediately after. Check spelling?

I think maybe Craig was just wondering where you came up with “SecretGlobal” since it is not documented (it is secret after all in Jim’s private arsenal).

I guess you’ll have to wait for a revised version of Panorama to address this.