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.

https://developer.apple.com/forums/thread/681907

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.

https://www.google.com/search?q=macos+monterey+no+php&sxsrf=AOaemvIoRMYx9W7KB_W_jbUSpPWBZ4Iz2Q%3A1637355855816&source=hp&ei=TxGYYdWHL-605OUP9qGI6Ak&iflsig=ALs-wAMAAAAAYZgfXznTRUzzku6VyBweJ9fPj4q5_DgE&oq=macos+monterey+php&gs_lcp=Cgdnd3Mtd2l6EAEYAjIFCAAQgAQyBQgAEIAEMgYIABAWEB46BAgjECc6EQguEIAEELEDEIMBEMcBEKMCOggIABCABBCxAzoOCC4QgAQQsQMQxwEQowI6CwgAEIAEELEDEIMBOgUILhCABDoLCC4QsQMQxwEQowI6DgguELEDEIMBEMcBENEDOggILhCxAxCDAToLCC4QgAQQsQMQgwE6CAguEIAEELEDOg4ILhCABBCxAxDHARDRAzoLCAAQgAQQsQMQyQM6BQgAEJIDOgUILhCxAzoECAAQAzoICAAQsQMQgwE6BwgAELEDEAo6CggAELEDEIMBEAo6BAgAEAo6BwgAEIAEEApKBQg8EgExUABY7iFgjjpoAXAAeACAAYgBiAGvD5IBBDEwLjmYAQCgAQE&sclient=gws-wiz

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:

/usr/bin/php

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 Terminal.app. 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 = 
"#!/some/where/else/python"

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.