How to install Composer on Shared servers
- Category : cPanel Question
- Posted on : Sep 12, 2020
- Views : 1,719
- By : HostSEO
Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on, and it will manage (install/update) them for you. Composer is not a package manager in the same sense as Yum or Apt are. Yes, it deals with 'packages' or libraries, but it manages them on a per-project basis, installing them in a directory (e.g., vendor) inside your project. By default, it will never install anything globally. Thus, it is a dependency manager.
To install Composer:
1. SSH access should be enabled for your hosting account with us. Follow the steps provided in this article to switch SSH access on.
2. To access your account via SSH, download and install one of the available SSH clients. You can find the list of free SSH clients here. In case you are using a Unix-based OS (Linux or OSX), you can easily run the Terminal application and connect to the server using the command:
ssh username@servername -pPORT
ssh - command for logging into the remote server
username - your cPanel username
servername- name of the server where your hosting account is located (you can find it using this tutorial)
PORT - connection port - 21098 for a Shared Hosting servers, 22 - for a VPS/Dedicated server
3. Open your SSH client, put your domain name or the IP address of the server into the Host Name field, enter 21098 or 22 into the Port field, choose SSH as your connection type and press the Open button:
4. If you receive PuTTY Security Alert, press Yes:
When prompted, enter your cPanel username and password (when you enter the password, it is automatically hidden for security purposes):
5. Composer requires PHP 5.5+ version, so we need to check whether the needed version is set up. Type the php -v command in PuTTY (or in Terminal) and you will get the following output:
6. If you need to change PHP version, log in to your cPanel, navigate to Software and Services section >> Select PHP Version menu:
7. Select 5.5-7.3 version from the drop-down menu and then click on the Set as current button:
PLEASE NOTE: Composer requires allow_url_fopen. It is enabled by default for all php versions on our Shared servers. Still, you may check if it is On by going to Switch to PHP Settings in Select PHP version menu:
You can also find additional information about PHP selector here.
8. Next, navigate to the folder you want to install Composer in. In our example, we will install Composer in public_html:
cd public_html
9. Now, you will need to find or create the php.ini file and some values to it. Log in to cPanel and navigate File Manager menu:
10. Go to the folder your Composer will be installed in and create a new file named php.ini using the +File button:
11. Open it by right-clicking the created php.ini file >> Edit:
12. Then add the following values to the file and hit the Save Changes button:
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
suhosin.executor.include.whitelist = phar
detect_unicode = Off
13. When all the preparations are done, you are ready to install Composer. Open PuTTY window where you have logged into your cPanel account and fill in the following command:
php -r "readfile('https://getcomposer.org/installer');" | php -c php.ini
This will execute the Composer installation:
To run composer commands use:
php composer.phar
or
php -c php.ini composer.phar
In case you get a notification Some settings on your machine make Composer unable to work properly, make sure that the PHP version is 5.5 or higher and all the changes in the php.ini file are saved.
That's it!
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu