Install Composer in your hosting account
Updated 27 Nov 2026
Composer installs the packages a PHP project needs (Laravel, Symfony and many others). You can install it in your own hosting account with cPanel's Terminal: no SSH program or ticket needed.
Composer 2 needs PHP 7.2 or newer. Check or change your PHP version first: see Select PHP Version.
1. Open the Terminal
In cPanel, under Advanced, open Terminal (or search for Terminal). Accept the one-time notice. The prompt looks like username@server:~$.
No Terminal on your account? Open a ticket and we turn it on.
2. Download and install Composer
Paste this whole block and press Enter. It downloads the official installer, checks its signature, and installs Composer in a bin folder in your home directory:
mkdir -p ~/bin
cd ~
EXPECTED="$(php -r "copy('https://composer.github.io/installer.sig','php://stdout');")"
php -r "copy('https://getcomposer.org/installer','composer-setup.php');"
php -r "echo (hash_file('sha384','composer-setup.php')==='$EXPECTED')?'installer OK'.PHP_EOL:'CHECKSUM MISMATCH'.PHP_EOL;"
php composer-setup.php --install-dir="$HOME/bin" --filename=composer
rm -f composer-setup.php
You should see installer OK, then Composer … successfully installed. If you see CHECKSUM MISMATCH, stop, and run the block again.
3. Make the composer command work everywhere
grep -q 'HOME/bin' ~/.bashrc || echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
export PATH="$HOME/bin:$PATH"
composer --version
A line like Composer version 2.x means it works.
4. Use it
Go to the folder with your project's composer.json, then:
cd ~/myapp
composer install --no-dev --optimize-autoloader
Other useful commands: composer require vendor/package (add a package), composer update (update packages), composer self-update (update Composer itself).
A different PHP version for one command: call Composer through that PHP, for example:
/opt/cpanel/ea-php83/root/usr/bin/php ~/bin/composer install
Change ea-php83 to the version you need.
Problems
| Message | Fix |
|---|---|
composer: command not found |
Run source ~/.bashrc or reopen the Terminal, or use ~/bin/composer. |
Allowed memory size … exhausted |
Run COMPOSER_MEMORY_LIMIT=-1 composer install. |
Your requirements could not be resolved / PHP version errors |
Your account's PHP version is older than the project needs: change it in Select PHP Version. |
ext-… is missing |
Turn the extension on under Select PHP Version › Extensions. |
For a Laravel site, point the domain's document root to the project's public folder (in cPanel Domains), and keep .env outside public_html.
Kwa Kiswahili
Composer husakinisha vifurushi vya miradi ya PHP (kama Laravel). Kwenye cPanel fungua Terminal, bandika amri za hatua ya 2 na 3, kisha nenda kwenye folda ya mradi na uendeshe composer install. Hakikisha toleo la PHP ni sahihi kwenye Select PHP Version.
Still need help? Open a ticket and we will reply.