Use Composer without Composer

If you have a shared managed hosting, probably you don’t have an SSH access to the server. And if you are reading this post, I think you need to run Composer to install some PHP software. With this easy trick you can install your dependencies.

First of all download p0wny-shell and upload it to your web hosting root. All the commands must be sent using this webshell

Then download the latest composer.phar from Composer website via wget

$ wget https://getcomposer.org/composer.phar

In order to install the dependencies of the package, you have to run composer via PHP. Simply run the following commands.

First of all move composer into the library directory and get in

$ mv ./composer.phar /path/to/lib/
$ cd /path/to/lib/

Composer needs an home path to run. Let’s export it and run our script:

$ export COMPOSER_HOME=/home/myuser && php ./composer.phar

If you are not sure of your username (“myuser”) run the following command:

$ whoami

If your php binary isn’t linked in the standard path, you can try to locate it in the root of the system or in other paths or try to run:

$ locate php

In my case, due to my web hosting configuration, I had to run all the commands exporting always the COMPOSER_HOME env variable.

Obviously remember to REMOVE THE WEB SHELL at the end of installation…security first!

Hope this will help.

Cheers




This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.

2 thoughts on “Use Composer without Composer”

  1. Hello,

    Great article, but you may add a “warning” to tell the reader that the shell MUST be removed once the install complete as this script is very dangerous if you keep it on the hosting. 🙂️

Leave a Reply to edo Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.