in Synology

Here are some simple instructions on how to get Composer working along your Web Station package for app/web development.


Assets Used:

  • DSM 6.1.x
  • DSM Web Station (running nginx, but works with apache as well)
  • DSM Package PHP 7 (you can use 5.6 as well)

Instructions:

  1. Open Web Station, go to PHP Settings:
  2. Check “phar” (PHP Archive support):
  3. Press “Apply
  4. SSH your NAS, and issue the install commands (note this will install for the current user):
    sudo su
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
    php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
    php composer-setup.php
    php -r "unlink('composer-setup.php');"
  5. If it fails to install, just grab the new commands directly from https://getcomposer.org/download/, as the hash will vary whenever a new version of the file is released.
  6. You should see a success message as the one below:
    All settings correct for using Composer
    Downloading...
    
    Composer (version 1.4.2) successfully installed to: /volume1/homes/adminuser/composer.phar
    Use it: php composer.phar
    
  7. It should run by issuing:
    php ~/composer.phar

Additional Notes:

  • To update composer, use:
    sudo php ~/composer.phar self-update

 

Advertisement