21

Is it possible to run composer on a cheap webspace that can't be accessed using ssh, only ftp?

Running system('php composer.phar install'); should work in theory - is that the recommended method?

2
  • 4
    If you can FTP upload.. you can compose your script in local host and then upload it to your server.. ++ at some scripts composer gets many test/documentation files which are not required for the script to run and its not very nice to put them at your server (if you have limit space..) Commented Apr 12, 2013 at 11:23
  • 5
    You could run composer locally and then just upload the packages afterwards. Commented Apr 12, 2013 at 11:23

2 Answers 2

19

I think the best way, as suggested in the comments before, is to execute the composer step on a local system that is able to do it, and then upload the result via FTP.

Composer has some (probably optional) software dependencies that most likely will not be available on your webspace. For example it needs the Git and SVN client software in case the project you are about to install references such dependencies.

Another thing is that downloading from Github (or anywhere else) can fail. Or trigger the API limit and ask for a login.

You'd really want to collect all the software and know that it worked instead of hoping it will execute well remotely.

Sign up to request clarification or add additional context in comments.

1 Comment

I just did it for PHPMailer and it was working perfectly, and without editing any file !
10

I have successfully installed Composer on my shared hosting using only FTP:

  1. Install PHPShell on a shared hosting

  2. In PHPShell's config.php add a user and an alias:

    php = "php -d suhosin.executor.include.whitelist=phar"

  3. Log in to PHPShell and type: curl -sS https://getcomposer.org/installer | php

  4. When successfully installed, run Composer: php composer.phar

4 Comments

@FewFlyBy What's the problem?
PHP not found. That is what I got. Also, it seem you had 5 parts to this not 4? or is this to create a login? php = "php -d suhosin.executor.include.whitelist=phar" If so, what would that actual login credentials be?
@GaryCarlyleCook Are you sure you have PHP installed and available in the PATH? Read the INSTALL file of PHPShell on how to install it on your host.
This will only work if the web host hasn't disabled shell_exec. Most shared webhosting services have, so this will not work on most shared webhosting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.