how to install composer on synology

By default, phar extension is not enabled, installation will be failed:

enable phar extension:

now get composer.phar

if you encounter this kind of error:

open DSM,  In the control-panel under Web-Services in the php-settings enable Customize PHP open_basedir, append the paths you wish:

now restart apache:

composer should now work as intended 🙂



  1. Statt

    vi /user/syno/etc/php/extentions.ini


    vi /usr/syno/etc/php/extentions.ini

    richtiger gewesen. (DS213j)

  2. Hello Darktalker,

    Thanks for the quick tutorial. It got me started on my way to install Laravel4 on my Synology.
    First Quick comments:
    – It’s possible to enable the phar extension from the Synology DSM5 Control Panel -> Web Services -> PHP Setting -> Enable PHP Extensions
    – To restart the Apache server, the command doesnt work, a work around is to change an Apache setting (i.e. HTTPS) , save, put it back, save.

    Now I’m wondering if you could help me. I’m stuck in my LARAVEL4 installation using composer, Google is not really helpful here 🙁

    Error Output: zend_mm_heap corrupted”

    Just wondering if you had any idea about this one.

    Thanks! 🙂

  3. Adding /root and /usr/bin to open_basedir is a crazy security risk.

    You may use safer solution:


  4. My 2 cents again:
    Using the latest DSM, I need to add ” /usr/local/bin ” to the open base dir


  5. I’d like to reiterate what AM says. You never, ever, ever want to do what it says to do in this article. The purpose of open_basedir is to prevent php scripts from running in directories where you don’t want them to run, including and especially home directories.

    The error above means you are running “php composer.phar install” as the root user, and you definitely don’t want to be doing that. The author of this article is essentially teaching you how to severely break security on your server. Don’t do it.

    Setting the variables like AM says will work but in most cases you’ll have to learn how to unpack/repack a phar archive, which is not really a fun thing to learn about. You’re better off running the command is a non-privileged user. The best candidate for that is probably the user that is running apache, which usually turns out to be the http user:

    sudo -u http php composer.phar install

    Sudo can be installed with ipkg. If you haven’t installed that on your synology yet, or don’t know how, you probably shouldn’t be doing admin-y type stuff until you read a book on Unix/Linux administration best practices.

Leave a Reply