phpv
phpv copied to clipboard
PHPV simplifies PHP version management on Arch Linux-based systems like Manjaro, EndeavourOS, Garuda Linux, and ArcoLinux. Install, update, or switch PHP versions effortlessly with PHPV's intuitive co...
PHP Version Management Using PHPV on Arch Linux
Introduction
Managing PHP versions on Arch Linux systems (including Manjaro, EndeavourOS, Garuda Linux, and ArcoLinux) can be challenging. This comprehensive tutorial introduces PHPV, a tool designed to simplify the process of installing, updating, and switching PHP versions efficiently. Follow these steps to streamline your PHP version management on Arch Linux.
Installation Guide
Downloading PHPV
For a quick and efficient installation, use the following command:
curl -sSL https://raw.githubusercontent.com/Its-Satyajit/phpv/main/install.sh | bash
Tip: Ensure you have curl installed on your system. If not, install it using sudo pacman -S curl.
Manual Installation (Optional)
Follow these steps for manual installation:
-
Clone the Repository:
git clone https://github.com/Its-Satyajit/phpv.gitSuggestion: Verify that
gitis installed. If not, install it withsudo pacman -S git. -
Navigate and Grant Permissions:
cd phpv chmod +x phpvTip: Always check the permissions of the script before executing it to ensure it’s safe to run.
-
Install PHPV:
mv phpv $HOME/bin/phpvSuggestion: If
$HOME/bindoes not exist, create it usingmkdir -p $HOME/bin. -
Update Shell Configuration:
Add the following line to your shell configuration file (e.g., ~/.bashrc, ~/.bash_profile):
export PATH="$HOME/bin:$PATH"Tip: Use a text editor like
nanoorvimto edit your shell configuration file. For example,nano ~/.bashrc. -
Refresh Terminal:
source ~/.bashrc # Replace with your appropriate shell commandSuggestion: If you use a different shell, update the corresponding configuration file (e.g.,
~/.zshrcfor Zsh).
Usage
Installing/Updating/Reinstalling PHP Versions
To install, update, or reinstall PHP versions, use the following command:
phpv -i <version>
Replace <version> with the desired shorthand (e.g., 80 for 8.0, 74 for 7.4).
Tip: Always check for the latest PHP versions and their shorthand notations to keep your environment up to date.
Install

Update/Reinstall

Switching PHP Versions
To switch PHP versions, use the following command:
phpv <version>
Replace <version> with the desired shorthand.
Suggestion: After switching versions, verify the PHP version with php -v to ensure the correct version is active.
Switch

Troubleshooting
If you encounter issues with the c-client dependency, follow the steps outlined below for manual installation.
Pre-built Binary for Easy Resolution
Download the pre-built c-client binary from PHPV:
Verification (Optional):
Verify the binary's integrity using the following hash values:
- MD5: 96d92a8b98afd78d2f2c80f8b0d76473
- SHA1: 4451582984bf02b1b78425b75100ca20018c8557
- SHA256: c6c9a0a411f476be1357f5aad8db897ce4d47f3f78757acd2aade3e477e2fe4d
- SHA512: 9628031b0f0efe4024c515f0a882418d7665b3267644f3bf0f12adbc5f200a9cca3049ab218be176ae8562673edca46190ca44de1154a32e0bf828028470ef1e
For additional verification, use VirusTotal.
Manual Compilation (Advanced Users Only)
Disclaimer: Manual compilation can introduce conflicts with existing system packages. It is recommended to use the pre-built binary or your system's package manager (e.g., pacman) for a safer installation.
Manual Compilation Steps:
-
Gather Your Tools:
Ensure you have the necessary development tools installed:
make- A C compiler (e.g.,
gcc) - Development headers for system libraries (
pacman -S base-devel)
Suggestion: Use
sudo pacman -S base-develto install essential development tools. -
Download the Source Code:
Access the official c-client source code repository: https://gitweb.gentoo.org/repo/gentoo.git/tree/
Tip: Always download the latest stable version to ensure compatibility and security.
-
Unpack the Source:
Extract the source code archive:
tar -zxvf c-client-X.Y.Z.tar.gzReplace
X.Y.Zwith the specific version number.Suggestion: Use the
lscommand to verify the contents of the extracted directory. -
Configure and Build:
Navigate into the extracted directory:
cd c-client-X.Y.ZConfigure and build with specific flags:
CFLAGS="-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types" ./configureWarning: Suppressing warnings can mask underlying issues. It is recommended to investigate the cause of these warnings and fix them if possible.
Tip: Use
./configure --helpto see all available configuration options. -
Dependency Management:
Ensure all necessary dependencies are installed. Use
pacmanto check for missing packages.Suggestion: Before starting the compilation, use
sudo pacman -Syuto update your system and installed packages. -
Installation:
If you choose to proceed with manual installation, use
sudo make install:sudo make installTip: Always review the
Makefilebefore runningmake installto understand the installation process.
By following these steps, you can manually compile the c-client library for PHPV. However, for most users, the pre-built binary or using the system's package manager is the recommended approach.