{"id":22903,"date":"2026-06-04T14:37:26","date_gmt":"2026-06-04T18:37:26","guid":{"rendered":"https:\/\/kb.n0c.com\/?post_type=ht_kb&#038;p=22903"},"modified":"2026-09-28T10:11:15","modified_gmt":"2026-09-28T14:11:15","slug":"how-to-install-composer","status":"publish","type":"ht_kb","link":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/","title":{"rendered":"How to Install Composer"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p>This article explains how to install <strong>Composer<\/strong>.<\/p>\n\n\n\n<p>Composer is a dependency manager for PHP that allows you to define third-party code packages used by a project, which can then be easily installed and updated. <\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">Users often do not know how to proceed, hence this article.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\"><meta charset=\"utf-8\"><strong>Note<\/strong>: <meta charset=\"utf-8\">The&nbsp;<a href=\"https:\/\/kb.n0c.com\/en\/glossary\/\" data-type=\"URL\" data-id=\"https:\/\/kb.n0c.com\/en\/glossary\/\">Glossary<\/a>&nbsp;contains explanations on multiple topics and can be consulted to clarify certain terms.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation of Composer<\/h2>\n\n\n\n<p>It is important to distinguish between a global Composer installation and a local one. Installing Composer globally allows you to use the dependency management tool from any folder on your system, whereas a local installation (within your project) restricts its use and the downloaded packages to the specific folder of the current project. For N0C, it is a local installation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Connect in SSH on your N0C account<\/h3>\n\n\n\n<p>First of all, you need to connect to the N0C account via SSH (<a href=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-create-an-ssh-key-and-connect-to-an-account\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Create an SSH Key and Connect to an Account Remotely<\/a>). Then, you can proceed with the installation.<\/p>\n\n\n\n<p class=\"wp-block-ht-blocks-messages wp-block-hb-message wp-block-hb-message--withicon is-style-info\">In the following commands, &#8220;user&#8221; must be replaced by the username of the N0C account in question.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Make Sure PHP is Well Installed<\/h3>\n\n\n\n<p>Before running the Composer installation, carry out a quick check to ensure that PHP is correctly installed and working properly.<\/p>\n\n\n\n<p>For instance, <code>php -v<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Download Composer<\/h3>\n\n\n\n<p>Start by entering the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -r \"copy('https:\/\/getcomposer.org\/installer', 'composer-setup.php');\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Add hash Verification (Optional)<\/h3>\n\n\n\n<p>Add hash verification, as explained at <a href=\"https:\/\/getcomposer.org\/download\/\">https:\/\/getcomposer.org\/download\/<\/a>. <\/p>\n\n\n\n<p>For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -r \"if (hash_file('sha384', 'composer-setup.php') === 'c8b085408188070d5f52bcfe4ecfbee5f727afa458b2573b8eaaf77b3419b0bf2768dc67c86944da1544f06fa544fd47') { echo 'Installer verified'.PHP_EOL; } else { echo 'Installer corrupt'.PHP_EOL; unlink('composer-setup.php'); exit(1); }\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Install\/Configure Composer<\/h3>\n\n\n\n<p>Enter this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php composer-setup.php<\/code><\/pre>\n\n\n\n<p>You can install a specific version of <strong>Composer<\/strong> using the &#8211;version= option. In this case, enter the following command instead (example with version 2.2.18):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php composer-setup.php --version=2.2.18<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Move to the Proper File<\/h3>\n\n\n\n<p>Add this to your code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir -p ~\/.local\/bin\nmv composer.phar ~\/.local\/bin\/composer<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Delete the Configuration File<\/h3>\n\n\n\n<p>Enter this command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -r \"unlink('composer-setup.php');\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Add Composer to PATH<\/h3>\n\n\n\n<p>Add this to your code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo 'export PATH=\"$PATH:$HOME\/.local\/bin\"' &gt;&gt; ~\/.bash_profile\nsource ~\/.bash_profile<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Make a Verification<\/h3>\n\n\n\n<p>To check this, type the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\ncomposer --version<\/code><\/pre>\n\n\n\n<p>The following message will appear:<\/p>\n\n\n\n<p><em>All settings correct for using Composer<br>Downloading&#8230;<br>Composer (version 2.3.4) successfully installed to: \/home\/zjpqumjq\/composer.phar<br>Use it: php composer.phar<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This article explains how to install Composer. Composer is a dependency manager for PHP that allows you to define third-party code packages used by a project, which can then be easily installed and updated. Installation of Composer It is important to distinguish between a global Composer installation and a&#8230;<\/p>\n","protected":false},"author":4,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[163],"ht-kb-tag":[],"class_list":["post-22903","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-languages"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Composer - N0C KB<\/title>\n<meta name=\"description\" content=\"This article explains how to install Composer.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Composer - N0C KB\" \/>\n<meta property=\"og:description\" content=\"This article explains how to install Composer.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/\" \/>\n<meta property=\"og:site_name\" content=\"N0C KB\" \/>\n<meta property=\"article:modified_time\" content=\"2026-09-28T14:11:15+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/how-to-install-composer\\\/\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/how-to-install-composer\\\/\",\"name\":\"How to Install Composer - N0C KB\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\"},\"datePublished\":\"2026-06-04T18:37:26+00:00\",\"dateModified\":\"2026-09-28T14:11:15+00:00\",\"description\":\"This article explains how to install Composer.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/how-to-install-composer\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/how-to-install-composer\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/how-to-install-composer\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Articles\",\"item\":\"https:\\\/\\\/kb.n0c.com\\\/en\\\/knowledge-base\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Install Composer\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/kb.n0c.com\\\/#website\",\"url\":\"https:\\\/\\\/kb.n0c.com\\\/\",\"name\":\"N0C KB\",\"description\":\"Official documentation of the N0C hosting platform\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/kb.n0c.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Composer - N0C KB","description":"This article explains how to install Composer.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Composer - N0C KB","og_description":"This article explains how to install Composer.","og_url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/","og_site_name":"N0C KB","article_modified_time":"2026-09-28T14:11:15+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/","url":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/","name":"How to Install Composer - N0C KB","isPartOf":{"@id":"https:\/\/kb.n0c.com\/#website"},"datePublished":"2026-06-04T18:37:26+00:00","dateModified":"2026-09-28T14:11:15+00:00","description":"This article explains how to install Composer.","breadcrumb":{"@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kb.n0c.com\/en\/knowledge-base\/how-to-install-composer\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/kb.n0c.com\/"},{"@type":"ListItem","position":2,"name":"Articles","item":"https:\/\/kb.n0c.com\/en\/knowledge-base\/"},{"@type":"ListItem","position":3,"name":"How to Install Composer"}]},{"@type":"WebSite","@id":"https:\/\/kb.n0c.com\/#website","url":"https:\/\/kb.n0c.com\/","name":"N0C KB","description":"Official documentation of the N0C hosting platform","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kb.n0c.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/22903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/comments?post=22903"}],"version-history":[{"count":3,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/22903\/revisions"}],"predecessor-version":[{"id":25238,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb\/22903\/revisions\/25238"}],"wp:attachment":[{"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/media?parent=22903"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-category?post=22903"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/kb.n0c.com\/en\/wp-json\/wp\/v2\/ht-kb-tag?post=22903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}