Sphp.sh
Shell script for switching between Brew-installed PHP versions
Install / Use
/learn @rhukster/Sphp.shREADME
sphp.sh
Shell script for switching between Brew-installed PHP versions, as featured in the popular macOS Apache + PHP series on https://getgrav.org.
The code has been moved from the original gist to a proper repository, to better allow for pull requests and issues.
Installation
Intel Macs:
Install various versions of PHP per macOS Apache + PHP series using Homebrew.
curl -L https://raw.githubusercontent.com/rhukster/sphp.sh/main/sphp.sh > /usr/local/bin/sphp
chmod +x /usr/local/bin/sphp
Apple Silicon Macs:
curl -L https://raw.githubusercontent.com/rhukster/sphp.sh/main/sphp.sh > /opt/homebrew/bin/sphp
chmod +x /opt/homebrew/bin/sphp
Usage
To switch your current PHP installation to PHP 8.2, simply enter this command in the terminal:
➜ sphp 8.2
Result:
Switching to php@8.2
Switching your shell
Unlinking /opt/homebrew/Cellar/php@7.3/7.3.33_4... 0 symlinks removed.
Unlinking /opt/homebrew/Cellar/php@7.4/7.4.33_1... 25 symlinks removed.
Unlinking /opt/homebrew/Cellar/php@8.0/8.0.27_1... 0 symlinks removed.
Unlinking /opt/homebrew/Cellar/php@8.1/8.1.15... 0 symlinks removed.
Unlinking /opt/homebrew/Cellar/php/8.2.3... 0 symlinks removed.
Linking /opt/homebrew/Cellar/php/8.2.3... 24 symlinks created.
Switching your apache conf
Restarting apache
Stopping `httpd`... (might take a while)
==> Successfully stopped `httpd` (label: homebrew.mxcl.httpd)
==> Successfully started `httpd` (label: homebrew.mxcl.httpd)
PHP 8.2.3 (cli) (built: Feb 15 2023 00:18:01) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
with Zend OPcache v8.2.3, Copyright (c), by Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
All done!
Support
Submit a new bug report on the Github repository.
All code contributions (bug fixes, new features and enhancements) are welcome. Please submit a Pull Request.
License and Copyright
Copyright (c) 2023 Andy Miller
Released under the MIT License
Related Skills
node-connect
345.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
106.4kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
