Install PHP 8.5 with ASDF on Arch Linux
Source: Dev.to
This quick tutorial shows how to install ASDF Version Manager on Arch Linux and use it to install PHP 8.5. First, install the required packages and build dependencies: yay -S base-devel libpng postgresql-libs re2c gd oniguruma libzip libsodium
You may also want to install additional common dependencies: yay -S curl git openssl zlib libxml2 sqlite
Clone the ASDF repository: git clone https://github.com/asdf-vm/asdf.git ~/.asdf —branch v0.18.0
Add ASDF to your shell configuration. echo ’. “$HOME/.asdf/asdf.sh”’ >> ~/.bashrc echo ’. “$HOME/.asdf/completions/asdf.bash”’ >> ~/.bashrc source ~/.bashrc
echo ’. “$HOME/.asdf/asdf.sh”’ >> ~/.zshrc echo ’. “$HOME/.asdf/completions/asdf.bash”’ >> ~/.zshrc source ~/.zshrc
Verify installation: asdf —version
Install the PHP plugin for ASDF: asdf plugin add php https://github.com/asdf-community/asdf-php.git
List available PHP versions: asdf list all php
Install PHP 8.5: asdf install php 8.5.0
Set PHP 8.5 as the global default: asdf global php 8.5.0
Reload your shell: exec $SHELL
Verify the installation: php -v
Expected output: PHP 8.5.x (cli)
List installed PHP versions: asdf list php
Install another PHP version: asdf install php 8.4.0
Switch globally: asdf global php 8.4.0
Switch locally for a project: asdf local php 8.5.0
After installing PHP, install Composer globally: php -r “copy(‘https://getcomposer.org/installer’, ‘composer-setup.php’);” php composer-setup.php sudo mv composer.phar /usr/local/bin/composer rm composer-setup.php
Verify: composer —version