Current revision updated by vtopping3 on
Originally created by vtopping3 on

From the docs: https://getcomposer.org/download/ Please use the commands from the doc as the latest version will be posted there. The code example that follows is just an example:

As the root user and in the root of your project directory run:

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'dac665fdc30fdd8ec78b38b9800061b4150413ff2e3b6f88543c636f7cd84f6db9189d43a81e5503cda447da73c7e5b6') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Then run:

sudo mv composer.phar /usr/local/bin/composer

 

Updates to your /usr/share/httpd:

 

create .cache/composer/vcs and change the owner of .cache chown -R apache:apache

Now you can run composer commands in the root of your project where the composer.json file is located.

Next, in your /usr/share/httpd create .bash_rc and .bash_profile files. In .bash_profile source .bashrc as:

source /usr/share/httpd/.bashrc

and in your .bashrc file add your composer and drush paths as:

export PATH=$PATH:/usr/local/bin
export PATH="$HOME/.composer/vendor/bin:$PATH"
alias drush='[full path to site directory]/vendor/drush/drush/drush'

 

After running composer initially the contents of the /usr/share/httpd will look something like this:

drwxr-xr-x    7 root   root    4096 Jun 21 10:22 .
drwxr-xr-x. 103 root   root    4096 Jun  3 21:11 ..
-rw-r--r--    1 root   root      32 Jun 21 10:21 .bash_profile
-rw-r--r--    1 root   root     160 Jun 21 10:22 .bashrc
drwxr-xr-x    3 apache apache  4096 Jun 21 10:26 .cache
drwxr-xr-x    3 root   root    4096 Jun 20 11:25 error
drwxr-xr-x    3 root   root   20480 Jun 20 11:25 icons
drwxr-xr-x    2 root   root    4096 Jun 20 11:25 noindex
drwx------    2 apache apache  4096 Jun 20 15:46 .ssh

Also, on the initial composer run you might be asked for your github password. Also it might be necessary to create a /usr/share/httpd/.config/composer/auth.json file then rerun composer for it to complete.

Identifier Categories
Specific categories