Server Management
Install Composer PHP 8.3 in IONOS Shared Hosting Linux
By Admin
•
January 28, 2026
Running modern PHP applications on IONOS Shared Hosting often requires Composer. By default, the system might point to an older PHP version. This guide walks you through setting up PHP 8.3 and Composer correctly using a unified automated script.
Step 1 Create the script file
Log in to your server via SSH and run this command to create a new shell script file:
Terminal
nano composer.sh
Step 2 Paste the Installation Script
Copy the following code and paste it into the editor. This script handles the download, verification, and alias creation automatically.
BASH SCRIPT
#!/bin/bash
# 1. Install Composer using PHP 8.3
cd ~
echo "Installing Composer..."
curl -sS https://getcomposer.org/installer | /usr/bin/php8.3-cli
# 2. Run Composer to test it works
echo "Testing Composer..."
/usr/bin/php8.3-cli composer.phar --version
# 3. Create aliases in .bashrc
echo "Adding aliases to .bashrc..."
if ! grep -q "alias php='/usr/bin/php8.3-cli'" ~/.bashrc; then
echo "" >> ~/.bashrc
echo "# Custom PHP 8.3 Aliases" >> ~/.bashrc
echo "alias php='/usr/bin/php8.3-cli'" >> ~/.bashrc
echo "alias composer='/usr/bin/php8.3-cli ~/composer.phar'" >> ~/.bashrc
echo "Aliases added."
else
echo "Aliases already exist in .bashrc."
fi
# 4. Source and Test
shopt -s expand_aliases
source ~/.bashrc
echo "--------------------------------------------------"
echo "Testing php -v inside this script:"
php -v
echo "--------------------------------------------------"
Step 3 Run the Installation
Save the file (Ctrl+O, Enter) and exit (Ctrl+X). Then, make the script executable and run it:
Terminal
chmod +x composer.sh
./composer.sh
✅
Success!
Composer is now installed and ready to use.
⚠️ Important IONOS Notes
- IONOS requires explicit paths. Always use
/usr/bin/php8.3-cliinstead of justphpunless aliases are active. - It uses
composer.pharlocated in your home directory instead of a global bin. - If the command isn't recognized immediately, refresh your session with:
source ~/.bashrc
Added by Admin2026