iToverDose/Software· 5 JUNE 2026 · 16:03

Master PHP 8.5 on Arch Linux with ASDF version manager

Switch between PHP versions effortlessly on Arch Linux by leveraging ASDF. This guide walks through dependency setup, ASDF installation, and PHP 8.5 configuration in under 10 minutes.

DEV Community3 min read0 Comments

Managing multiple PHP environments on Arch Linux no longer requires manual compilation or juggling system packages. ASDF, a language-agnostic version manager, simplifies the process by letting you install, switch, and manage PHP versions with a few commands. Here’s how to set up PHP 8.5 on Arch Linux using ASDF in under 10 minutes.

Prepare Arch Linux for ASDF and PHP

Before installing ASDF, ensure your Arch Linux system has the necessary build tools and libraries. These dependencies ensure smooth compilation and functionality of PHP 8.5.

Run the following command to install the core dependencies:

yay -S base-devel libpng postgresql-libs re2c gd oniguruma libzip libsodium

For broader compatibility, consider adding common development libraries:

yay -S curl git openssl zlib libxml2 sqlite

These packages cover most PHP extension requirements and prevent missing dependency errors during installation.

Install ASDF on Arch Linux

ASDF acts as a centralized version manager for multiple runtime environments. Start by cloning the ASDF repository to your home directory:

git clone  ~/.asdf --branch v0.18.0

Next, integrate ASDF into your shell configuration. The process differs slightly between Bash and ZSH users.

For Bash users

Add the following lines to your ~/.bashrc file:

echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc

Reload your shell to apply changes:

source ~/.bashrc

For ZSH users

Similarly, update your ~/.zshrc file:

echo '. "$HOME/.asdf/asdf.sh"' >> ~/.zshrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.zshrc

Reload ZSH to activate ASDF:

source ~/.zshrc

Confirm ASDF is installed correctly by checking its version:

asdf --version

Install PHP 8.5 via ASDF

With ASDF ready, add the PHP plugin to manage PHP versions seamlessly.

asdf plugin add php 

Explore and Install PHP 8.5

List all available PHP versions to identify the latest stable release:

asdf list all php

Install PHP 8.5.0 using ASDF:

asdf install php 8.5.0

Set PHP 8.5 as your global default environment:

asdf global php 8.5.0

Apply changes by reloading your shell session:

exec $SHELL

Verify the installation by checking the PHP version:

php -v

The expected output should show:

PHP 8.5.x (cli)

Switch and Manage PHP Versions Easily

ASDF simplifies version switching across projects or system-wide. Use these commands to manage PHP installations effectively.

  • List installed PHP versions:
asdf list php
  • Install an additional version (e.g., PHP 8.4.0):
asdf install php 8.4.0
  • Switch globally to a different version:
asdf global php 8.4.0
  • Set a local version for a specific project:
asdf local php 8.5.0

These commands eliminate the need for manual symlink adjustments or environment variable tweaks.

Optional: Install Composer for PHP Dependency Management

After setting up PHP 8.5, install Composer to streamline dependency management in your projects.

Run the following commands to install Composer globally:

php -r "copy(' 'composer-setup.php');"
php composer-setup.php
sudo mv composer.phar /usr/local/bin/composer
rm composer-setup.php

Confirm Composer is ready by checking its version:

composer --version

With PHP 8.5 and Composer installed, your Arch Linux environment is optimized for modern PHP development, allowing flexible version switching and efficient dependency handling.

As PHP continues to evolve, leveraging tools like ASDF ensures you stay ahead with minimal overhead. Whether you’re testing new features or maintaining legacy applications, ASDF provides a robust foundation for managing PHP environments across your workflows.

AI summary

Arch Linux üzerinde PHP 8.5'i ASDF sürüm yöneticisi ile nasıl kuracağınızı, farklı versiyonlar arasında geçiş yapacağınızı ve Composer'ı entegre edeceğinizi adım adım öğrenin.

Comments

00
LEAVE A COMMENT
ID #GO9074

0 / 1200 CHARACTERS

Human check

2 + 8 = ?

Will appear after editor review

Moderation · Spam protection active

No approved comments yet. Be first.