In this brief description, you will learn about Compose PHP package manager installation. This suite is not always needed, but in some cases you may not be able to avoid it. For example, I had to use it on this Drupal-based web site, so I installed it from the beginning, and since then I can effectively manage it, update this CMS system.
There are two ways to install Composer: In local mode, when the package manager is part of a project, it can only be used in the project directory, or it can be installed globally as an executable program available from the entire Linux system. I prefer the latter as it may be needed at any time eg. another website on the same server, so it makes more sense to deploy it centrally.
First, log in as root, then go to the / tmp directory, where you temporarily store the files:
sudo su
cd /tmp
Create a temporary directory, log in and then wget command to download the Composer a from the official site:
mkdir composer
cd composer
wget https://getcomposer.org/installer
This will give you a file called "installer". Install using php (since this is a php file):
php /tmp/composer/installer
The installer checks the required PHP conditions and then downloads an executable (also php) file with the .phar extension. Output:
Downloading... Composer (version 1.6.5) successfully installed to: /tmp/composer/composer.phar Use it: php composer.phar
From now on, you will be able to run the installation of various library dependencies with this file, but before that you need to place it in a place where you can access it from anywhere, such as / usr / local / bin:
mv /tmp/composer/composer.phar /usr/local/bin/composer
At the same time, we take down its extension so that it just needs to be run as a composer. So we have an ubiquitous (in PATH) executable file that any user can easily run.
If the file is still not executable, make it executable with the following command:
chmod +x /usr/local/bin/composer
Finally, delete the working directory:
cd /tmp
rm -rf composer/
To check the result, quit root and run composer as a regular user with a version check:
composer --version
Composer version 1.6.5 2018-05-04 11:44:59
Now you can see that Composer is very easy to install and you can now use it comfortably on any server for any project or website.
- To post registration and login required
- 460 views