I updated to Monterey and I am trying to build my xcode project.
I have a custom php script that runs in Build Phases and I am getting the following error.
/Users/jonathan/Library/Developer/Xcode/DerivedData/SwiftApp-aboxvgocemtxyjcdbgadfktiyxvd/Build/Intermediates.noindex/SwiftApp.build/Debug Dev-iphoneos/SiteSelectedLibraryApp.build/Script-025223DA20C597E100D80A6A.sh: line 3: php: command not found
Command PhaseScriptExecution failed with a nonzero exit code
I have installed php with brew install php@8.0. I can run php in the terminal now but xcode can't seem to find it.
I ran into the same issue.
After a lot of searching over the internet, I found this solution.
It would help if you went to this library: https://github.com/shivammathur/homebrew-php
Follow these steps:
xcode-select --install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap shivammathur/php
brew install shivammathur/php/php@8.0
brew link --overwrite --force shivammathur/php/php@8.0
If this command throws an error, then select any one path it shows on the terminal and execute it: For me, I selected this path to override:
echo 'export PATH="/usr/local/opt/php@8.0/bin:$PATH"' >> ~/.zshrc
php -v
already linked
:brew link --overwrite --force shivammathur/php/php@8.0
That's it.
Now Xcode will run the PHP script without any error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.