Changes
Title
unchanged
Moving the vendor directory for multiple projects
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
config, yii2, yii2 intallation
Content
changed
[...]
1. the **/web/index.php** and **yii** (right under the project directory -- for Yii command from CLI). change the two lines of required file path (**autoload.php** & **yii.php**) to the correct vendor location.
2. the **/config/web.php**. add **vendorPath** to the config with your vendor directory.
```php
$config = [
// if your framework vendor directory is moved to another place
// which is not standard, then set the vendorPath attribute to
// the new vendor directory.
'vendorPath' => '../../frameworks/yii2',
'components' => [...]
// ... other configs
]
```
### Composer
As the vendor is moved from **/var/www/html/myapp
/vendor** to **/var/www/html/frameworks/yii2**, you will find problem installing a new extension or updating the existing through **composer** command.
tTo fix it, modify your **composer.json** (right under your project directory) by adding the **vendor-dir** attribute under the **config** section, eg:
```php
// other settings ...
"config": {
"vendor-dir":"/var/www/html/frameworks/yii2",
"process-timeout": 1800
},
// other settings ...
```
Also, you may find **"a man-in-the-middle attack"** message when either update or install the new extension (i don't know if there is a relation to the modification of **composer.json** but i get it several times during experiment
ing this). ts).
To fix it run **composer update --dry-run**.
Done!