{"id":1003,"date":"2021-12-07T08:12:02","date_gmt":"2021-12-07T08:12:02","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2021\/12\/07\/5792082-how-to-solve-common-composer-issues-at-hostinger\/"},"modified":"2026-03-16T12:12:09","modified_gmt":"2026-03-16T12:12:09","slug":"5792082-how-to-solve-common-composer-issues-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/5792082-how-to-solve-common-composer-issues-at-hostinger\/","title":{"rendered":"How to solve common Composer issues at Hostinger"},"content":{"rendered":"<p class=\"no-margin\">Composer 1 (deprecated) and Composer 2 are readily available on our Web Premium, Web Business, and Cloud plans, as they come <b>pre-installed<\/b>. However, you may encounter some package installation, permission, or memory issues while using either of them. Follow the steps below to identify and resolve these issues:<\/p><h2 id=\"h_554f0f37a2\">You should upgrade to Composer 2 message<\/h2><p class=\"no-margin\">Starting with <b>PHP version 8.0<\/b>, Composer 1 is no longer supported. If you attempt to install packages using Composer 1 with PHP 8.0 or higher, you&rsquo;ll encounter an error message prompting you to upgrade to Composer 2:<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2021\/12\/7e73c9a0-0b30-49fe-8d9f-a205e98fe1d1.jpg\" alt=\"The message: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2.\"><\/div><p class=\"no-margin\">To address this, use the <code>composer2<\/code> command instead of the deprecated <code>composer<\/code> command. For instance, to install the <a class=\"intercom-content-link\" href=\"https:\/\/packagist.org\/packages\/gumlet\/php-image-resize\" target=\"_blank\" rel=\"noopener\">gumlet\/php-image-resize<\/a> package, use:<\/p><pre><code>composer2 require gumlet\/php-image-resize <\/code><\/pre><p class=\"no-margin\">The command may be intepreted automatically to try and install the package using version 2.0, if available. Otherwise, you can try with the <b>composer2 <\/b>command instead.<\/p><p class=\"no-margin\">If the command or package you need is only available on Composer 1, you can temporarily <a class=\"intercom-content-link\" href=\"\/support\/1575755-how-can-i-change-my-php-version\" target=\"_blank\" rel=\"noopener\">lower your PHP version<\/a>. However, for security reasons, it is recommended to <b>update your scripts or code<\/b> to work with the <b>latest PHP version<\/b>.<\/p><h2 id=\"h_bdbdb7a100\">Permission denied<\/h2><p class=\"no-margin\">The installation of Composer 1 and Composer 2 is global accross our servers, meaning that the <a class=\"intercom-content-link\" href=\"\/support\/5792078-how-to-use-composer#h_7eb4b9f5ce\" target=\"_blank\" rel=\"noopener\">available versions<\/a> are fixed. Attempting to <b>update Composer<\/b> using the following commands:<\/p><p class=\"no-margin\"><code>composer self-update<\/code> <b>or<\/b> <code>composer self-update --2<\/code><\/p><p class=\"no-margin\">Or other commands requiring higher permissions may result in a &ldquo;Permission denied&rdquo; error:<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2021\/12\/a3b868bd-d96a-48d8-a9c0-d58e17b0f53b.jpg\" alt=\"Composer update failed error messgae indicating it is a read-only file system\"><\/div><p class=\"no-margin\">To fix this, you will need to download and install the Composer locally for each project that requires it. Follow this guide to complete the process: <a class=\"intercom-content-link\" href=\"\/support\/8727597-how-to-install-composer-locally\" target=\"_blank\" rel=\"noopener\">How to install Composer locally<\/a>.<\/p><p class=\"no-margin\">Once installed, you&rsquo;ll find a new <b>composer.phar<\/b> file on the installation path:<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2021\/12\/876511ae-536e-4e1a-962b-65ecda660256.jpg\" alt=\"The ls command showing the composer.phar file\" width=\"180\"><\/div><p class=\"no-margin\">You can now run any command, including <code>self-update<\/code>, by executing locally. Use this format:<\/p><pre><code>.\/composer.phar [COMMAND]<\/code><\/pre><p class=\"no-margin\">For example, to update Composer locally, enter:<\/p><pre><code>.\/composer.phar self-update --2<\/code><\/pre><h2 id=\"h_fb1f33a80e\">Memory exhausted<\/h2><p class=\"no-margin\">If you encounter a <b>Memory exhausted<\/b> error after running Composer commands, it indicates that your project has exceeded the available memory limits of your hosting plan.<\/p><p class=\"no-margin\">To address this, try running Composer with an unlimited memory flag. Use this format for global Composer:<br>\n&#8203;<\/p><pre><code>php -d memory_limit=-1 \/usr\/local\/bin\/composer [COMMAND] <\/code><\/pre><p class=\"no-margin\">Or this format for a local Composer installation:<\/p><pre><code>php -d memory_limit=-1 composer.phar [COMMAND]<\/code><\/pre><p class=\"no-margin\">If the error persists, your project may needs more resources &ndash; to fix it, you can consider <a class=\"intercom-content-link\" href=\"\/support\/1583459-how-can-i-upgrade-my-hosting-account\" target=\"_blank\" rel=\"noopener\">upgrading your hosting plan<\/a>. Alternatively, you can run demanding commands on your local machine and then <a class=\"intercom-content-link\" href=\"\/support\/1884234-how-to-upload-backup-at-hostinger\" target=\"_blank\" rel=\"noopener\">upload your project<\/a> to your hosting.<\/p><h2 id=\"h-your-composer-dependencies-require-a-php-version\">Your Composer dependencies require a PHP version<\/h2><p data-start=\"236\" data-end=\"404\">When running Composer via SSH, the PHP version used is the default PHP version of the hosting plan, not the PHP version set for an individual website.<\/p><p data-start=\"406\" data-end=\"668\">Changing the PHP version for a specific website only affects how the site runs in the browser. It does not change the PHP version used by SSH or Composer. As a result, Composer may still run on an older PHP version even if your website is set to a newer one.<\/p><p data-start=\"670\" data-end=\"737\">To resolve this issue, you can choose one of the following options:<\/p><ul data-start=\"739\" data-end=\"955\">\n<li data-start=\"739\" data-end=\"861\">\n<p data-start=\"741\" data-end=\"861\"><a href=\"https:\/\/www.hostinger.com\/support\/1575755-how-to-change-the-php-version-of-your-hostinger-hosting-plan\/\">Change the PHP version of the hosting plan<\/a> so that the default CLI PHP meets Composer&rsquo;s requirements, or<\/p>\n<\/li>\n<li data-start=\"862\" data-end=\"955\">\n<p data-start=\"864\" data-end=\"955\">Run Composer with a specific PHP version by explicitly calling the required PHP binary:<\/p>\n<\/li>\n<\/ul><pre> \/opt\/alt\/[php-version]\/usr\/bin\/php \/usr\/local\/bin\/composer2 [composer-command]<\/pre><p>Replace <code>[php-version]<\/code> with the required PHP version (for example, <code>php84<\/code>) and <code>[composer-command]<\/code> with the actual Composer command you want to run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fixing the most frequent issues while using Composer at Hostinger<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[235],"tags":[],"class_list":["post-1003","post","type-post","status-publish","format-standard","hentry","category-ssh-connection-and-ssh-keys"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/5792082-how-to-solve-common-composer-issues-at-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/5792082-como-resolver-los-errores-mas-comunes-en-composer-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/5792082-comment-resoudre-les-problemes-les-plus-courants-lies-a-composer-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/5792082-bagaimana-mengatasi-kendala-yang-sering-terjadi-di-composer-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/5792082-como-solucionar-os-problemas-mais-comuns-do-composer-na-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/5792082-------composer--ho\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1003","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1003"}],"version-history":[{"count":3,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1003\/revisions"}],"predecessor-version":[{"id":7497,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1003\/revisions\/7497"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1003"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1003"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1003"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}