4

I am using localhost as my development server in which I added Composer and installed the Stripe dependencies.

Since I have a shared hosting account, I want to transfer the Composer files to my server since I don't have root access to run the Composer install locally.

Which files do I move, and where do I put them? I have moved composer.json composer.lock and the vendor folder into my sites root directory with all of my sites files and folders.

However, when I go to run a Stripe command I get errors in which I have to include each file in the directory. Obviously, Composer is not correct on the new server since I have to include each file.

How can I get it so that Composer works properly on the new server?

Matt Butler
  • 476
  • 6
  • 21
  • 1
    Can you post your error? Are you sure it doesn't have to do with auto loader itself – Gavindra Kalikapersaud Dec 16 '16 at 18:14
  • I quite literally moved the files onto the new server. I did not receive an error, but rather that the Stripe class isn't available since I did not include it. Therefore, Composer isn't working. I never installed it on the new server. Is this required for it to work? I thought I read differently somewhere.. – Matt Butler Dec 16 '16 at 18:18
  • Yes, it needs to be install on server. Are you running a linux server? – Gavindra Kalikapersaud Dec 16 '16 at 18:20
  • Yes, but it is a shared server – Matt Butler Dec 16 '16 at 18:26
  • then try: php composer-setup.php --install-dir={your directory}--filename=composer . This way it is install in that directory and not globally – Gavindra Kalikapersaud Dec 16 '16 at 18:58
  • Copying the vendor folder including autoloading files is enough, because Composer's Autoloading is not bound to a fixed location and should work. It seems to be a packaging (dependency included?) or autoloading issue. Please post your `composer.json` and the autoloading related code of your application. Thanks – Jens A. Koch Dec 18 '16 at 13:20

1 Answers1

1

First of all, you don't need root access to use Composer. Just download (or transfer from your local machine) composer.phar and use it on the server.

About copying: I advice to copy the whole project directory as is (with all src, vendor, bin dirs and other file). It's in your interests to make local and remote environments the same.

Alexey Shokov
  • 4,775
  • 1
  • 21
  • 22