2

I'm trying to learn Laravel and follow the instructions in their tutorial to install the framework on my shared hosting. I've disabled the secure-http option in composer but it still won't download the framework.

Called:

composer global require "laravel/installer"

Response:

Changed current directory to /home/sledzko/.composer
Warning: Accessing packagist.org over http which is an insecure protocol.

[LogicException]                                                              
Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.

What can I do to download the framework using composer?

5
  • Why don't you use the create-project instead of installer? Commented Feb 18, 2017 at 9:55
  • I've got that problem myself and did some searching. It seems that most common issue that create this problem is troubled internet connection. You may want to read this github discussion and this one Commented Feb 18, 2017 at 9:58
  • Why don't you ask you shared hosting company. Maybe they have a solution or another way to install Laravel. Commented Feb 18, 2017 at 9:58
  • @MarcoAurélioDeleu create-project doesn't work as well. Displays the same error Commented Feb 18, 2017 at 12:01
  • What is your composer version? Please run composer --version Commented Feb 18, 2017 at 12:19

4 Answers 4

3

Most of the shared hosting is not supported terminal/command access, that why it is not possible to install Laravel using composer on shared hosting.

But there is a way to use Laravel in shared hosting, you can install/setup Laravel project on a local machine and after that upload project (all directory structure and files) on your shared hosting. Only need to adjust public directory and bootstrap path in the index.php file.

Upload all files is in public folder in your shared hosting www/public_html folder, and all other folder structure in the separate folder. After that go to your index.php file in www/public_html folder and update below two linew with your path laravel folder path.

require DIR.'/../bootstrap/autoload.php'; $app = require_once DIR.'/../bootstrap/app.php';

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

1 Comment

I have SSH access and I'm currently using all those commands through SSH so that that's not an issue. I'll try the local installation, but I was hoping to install Laravel globally with composer.
2
  1. Install package locally using Composer. The package folder will be created in the vendor path.

  2. Copy vendor/packagename folder and paste it into your host's vendor path.

  3. Replace your host vendor/composer folder with your local vendor/composer folder.
  4. Replace your host composer.json with your local composer.json

Comments

1

please try:

composer create-project laravel/laravel --prefer-dist YOUR_PROJECT_NAME

This will help you to download the stable version on your machine!

2 Comments

This command results in error: [LogicException] Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.
Oh, sorry @Ajin, I have written false statements. Exactly is: composer create-project --prefer-dist laravel/laravel YOUR_PROJECT_NAME Hope can help you!
-2

If you use SiteGround you will be a lucky man, just must request access do ssh (over cpanel), and then run your composer command on terminal.

SiteGround servers already have composer globally installed.

BUT... you you want to do it on hard way, access you shell on Siteground and run:

 wget https://getcomposer.org/composer.phar -O ${HOME}/composer.phar
 echo "alias composer=\"/usr/local/php72/bin/php-cli ${HOME}/composer.phar \"" >> ${HOME}/.bashrc
 source ${HOME}/.bashrc
 composer --version

Just pay attention on php72 version, it's uses PHP 7.2. If you want or need another one do a ls /usr/local/ to see all versions.

1 Comment

Really sorry for the downvotes here, they are because of the post being discussed on meta. meta.stackoverflow.com/a/371788/4099593. I am probably to blame for that.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.