Quản lý PHP trên macOS (Homebrew)¶
Cài đặt PHP¶
# Cài PHP 8.4 (mới nhất)
brew install php
brew install php-intl
# Cài PHP 8.1
brew install [email protected]
brew install [email protected]
Chuyển đổi phiên bản PHP¶
Chuyển sang PHP 8.4¶
brew unlink [email protected]
brew link --force --overwrite php
brew services stop [email protected]
brew services start php
php -v
Chuyển sang PHP 8.1¶
brew unlink php
brew link --force --overwrite [email protected]
brew services stop php
brew services start [email protected]
php -v
Kiểm tra¶
# Xem các PHP đã cài
brew list --versions | grep php
# Xem PHP đang dùng
which php
php -v
# Kiểm tra intl extension
php -m | grep intl
# Xem services đang chạy
brew services list | grep php
File config PHP¶
- PHP 8.4:
/opt/homebrew/etc/php/8.4/php.ini - PHP 8.1:
/opt/homebrew/etc/php/8.1/php.ini
Gỡ cài đặt¶
# Gỡ PHP 8.4
brew uninstall php php-intl
# Gỡ PHP 8.1
brew uninstall [email protected] [email protected]