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?

Niko Sams
  • 4,304
  • 3
  • 25
  • 44
  • 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..) – Svetoslav Apr 12 '13 at 11:23
  • 5
    You could run composer locally and then just upload the packages afterwards. – alexarno Apr 12 '13 at 11:23

2 Answers2

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.

Sven
  • 69,403
  • 10
  • 107
  • 109
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

niutech
  • 28,923
  • 15
  • 96
  • 106
  • @FewFlyBy What's the problem? – niutech Dec 07 '16 at 23:48
  • 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? – Gary Carlyle Cook Apr 21 '17 at 20:29
  • @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. – niutech Apr 24 '17 at 11:30
  • 7
    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. – Phillipp Jul 12 '17 at 14:33