0

Yii2 advanced application with vendor folder its more than ~100 MB, so its very difficult to upload using FTP software.

  1. I need to update composer after uploading my application in a shared server.
  2. Unable to clone from git
2
  • If you have added vendor folder within you git repository. Please remove it from git. It is not recommended to add vendor folder within your repository. Commented Aug 8, 2015 at 15:42
  • 1
    Compress your source code into a zip file, upload this file to your hosting then extract it. Most of shared Hosting support unzip in cpanel. Commented Aug 8, 2015 at 20:15

2 Answers 2

3

Steps for deploying yii2 advanced app on a shared hosting (note : You need to have ssh access to the server, if not: contact your hosting provider)

  1. Generating a SSH Key Pair : open terminal and type the following

    ssh-keygen -t dsa

    OR

    ssh-keygen -t rsa

  2. The out put will be similar to

Generating public/private dsa key pair. Enter file in which to save the key (~/.ssh/id_dsa): Press [Enter] key Enter passphrase (empty for no passphrase): Press [Enter] key Enter same passphrase again: Press [Enter] key Your identification has been saved in ~/.ssh/id_dsa Your public key has been saved in ~/.ssh/id_dsa.pub The key fingerprint is:

OR

Generating public/private dsa key pair. Enter file in which to save the key (~/.ssh/id_dsa): Press [Enter] key Enter passphrase (empty for no passphrase): Press [Enter] key Enter same passphrase again: Press [Enter] key Your identification has been saved in ~/.ssh/id_dsa Your public key has been saved in ~/.ssh/id_dsa.pub The key fingerprint is:

  1. Create a directory as .ssh (note the preceding dot) under /home// for your hosting package on the remote host. You will then have to create a file named authorized_keys inside this .ssh directory
  2. Copy the content of the local ~/.ssh/id_dsa.pub or ~/.ssh/id_rsa.pub file into the authorized_keys file
  3. For connecting your server, open terminal and enter following

    ssh -l user remote-server

Replace user with your cpanel username and remote-server with your remote server host name. Enter your cpanel password, terminal will login your remote server using ssh.

  1. Clone your application from git repository

    git clone https://[email protected]/username/repository.git public_html

  2. Go to public_html do the following

    curl -sS https://getcomposer.org/installer | php

    php composer.phar global require "fxp/composer-asset-plugin:1.0.0"

    php init

  3. Set environment as Production (recommended)

    php composer.phar update

This will download all dependencies and setup your app, don't forget to configure database in main configuration file.

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

Comments

0

I recently had a similar problem and was without ssh access. I however noticed that the bulk of the size and files was caused by the .git folders of my project and the vendors. My solution was to set my FTP client to ignore all files and folders starting with .git.

On Filezilla, for example, this can be done by going to View->Filename Filters and editing the CVS and SVN filter to ignore '.git*'.

5 Comments

Why did you ignote git files?? if you are using git regularly, you can deploye whole project from git server, it will not use your local bandwidth and also very fast compare to FTP, yii is also a package so we can download it through composer.phar
No SSH access. Can't use git.
You just contact your hosting provider, bigrock and Godaddy are providing SSH access, then you can use .git also
What I meant was sometimes SSH isn't available e.g on a Windows machine.
Use Putty software for SSH in windows download with documentation from

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.