Symfony offline installation with composer

天涯浪子 提交于 2019-12-04 13:02:05

Do

composer install -o

to install. Then do all preparations like clear cache in prod/dev build assets and dump them

   php app/console cache:clear && php app/console cache:clear -e prod --no-debug
   php app/console assetic:dump -e prod --no-debug
   php app/console assets:install web --symlink --relative

then push/ftp your project to a server. I highly recomend you to run

composer dumpautoload -o

in order to update autolaod files on the server

UPDATE:

You could (should) also run a symfony's after-install script (after dumping autoload) in order to edit/update your parameters.yml on the Server, since db-access, mailer_transport will be probably different than on your dev-machine

composer run-script post-install-cmd
php app/console cache:clear -e prod --no-debug

then just run

php/console list

if you'll get a list of all available commands => your symfony app was successfully installed and runs

You can run composer on computer with connection to internet and copy all directory with files.

Composer to work mast make connection to internet, to check new version of package.

The short answer is yes and there are several ways to do that

As others have suggested the best choice is to build your project (install Symfony, install Composer, update dependencies) on a system that is connected to the internet and then just copy the project on the server.

Warning

The system where you build the project should be as similar as possible to the actual server (I mean PHP version, MySQL version, and so on) else the project may breaks.

You may want to build a Virtual Machine to make it really similar, which is good for development also. In that case you may take a look at tools like Ansible and Vagrant.

I've the same problem in symfony3.

Solution:

  1. Create archive of project - for safety.
  2. Copy project form server to computer with internet access (all files & directory): laptop.
  3. Run composer update on laptop.
  4. On server:

    rm -rf app/*
    rm -rf bin/*
    rm -rf var/cache/*
    rm -rf var/logs/*
    rm -rf var/sessions/*
    rm -rf vendor/*
    rm composer.json
    rm composer.lock

  5. Copy from laptop to server files to directory: app/, bin/, vendor/ and composer.json, composer.lock

Its work for me :-)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!