Страница 1 из 3

yii2 установка приложения yboard2

Добавлено: 2019.08.27, 10:53
relect
Имеем домен, белый ip + LAMP, установленный composer.
Готовое приложение https://github.com/glendemon/yboard2
Что-то никак не пойму как его установить на Yii2.
Можно пошаговую инструкцию?

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.27, 11:08
someweb
git clone https://github.com/glendemon/yboard2 /path_to_your_site
cd /path_to_your_site
composer install

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.27, 20:38
relect
>git clone https://github.com/glendemon/yboard2 /var/www/site/basic
>cd /var/www/site/basic
>composer create-project --prefer-dist yiisoft/yii2-app-basic /var/www/site/basic
[InvalidArgumentException]
Project directory /var/www/site/basic is not empty.


>git clone https://github.com/glendemon/yboard2 /var/www/site/basic
>cd /var/www/site/basic
>composer install

Страница недоступна Сайт пока не может обработать этот запрос.
HTTP ERROR 500


При этом
*<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName site
ServerAlias www.site
ServerAdmin webmaster@localhos
# Устанавливаем корневой директорией "basic/web"
DocumentRoot "/var/www/site/basic/web"
<Directory "/var/www/site/basic/web">
RewriteEngine on
# Если запрашиваемая в URL директория или файл существуют обращаемся к ним напрямую
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Если нет - перенаправляем запрос на index.php
RewriteRule . index.php
# ...прочие настройки...
</Directory>
Также
>composer create-project --prefer-dist yiisoft/yii2-app-basic /var/www/site/basic
>сp ybaord2 /var/www/site/basic

cd /var/www/site/basic

composer update -dev
[RuntimeException]
Invalid working directory specified, ev does not exist.

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 08:34
someweb
create project после git clone не нужен.
500 - смотрите логи апача, если там пусто - включите отображение ошибок в php.
composer update -dev
-d это --working-dir, надо --dev

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 14:28
relect
копирую из бэкапа (composer create-project --prefer-dist yiisoft/yii2-app-basic /var/www/site/basic)
далее копирую yboard2 в этуже папку /var/www/site/basic
потом
composer update --dev
....
- Installing symfony/var-dumper (v4.3.4): Downloading (100%)
...
InvalidConfigException {#4 ▼
#message: "The "id" configuration for the Application is required."
#code: 0
#file: "/var/www/site/basic/vendor/yiisoft/yii2/base/Application.php"
#line: 220
trace: {▶}
}
>git clone https://github.com/glendemon/yboard2 /var/www/site/basic
>cd /var/www/site/basic
>composer instal
Страница недоступна Сайт пока не может обработать этот запрос.
HTTP ERROR 500
По шагам:
1. создаю каталог /var/www/site (состояние сервера - Not Found The requested URL / was not found on this server.)
2. git clone https://github.com/glendemon/yboard2 /var/www/site/basic
получаю (HTTP ERROR 500).
3. composer install ничего не меняет (HTTP ERROR 500).

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 14:49
yiiliveext
Интересно, а зачем вам вообще этот yboard2? Это какая-то тестовая поделка, мало чем отличающаяся от шаблона basic.

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 14:55
relect
yiiliveext писал(а): 2019.08.28, 14:49 Интересно, а зачем вам вообще этот yboard2? Это какая-то тестовая поделка, мало чем отличающаяся от шаблона basic.
это готовое приложение доски объявлений. Я не сильно разбираюсь как работает composer?
Если composer установлен в системе, то зачем после приложение снова ставить composer install и чем он отличается
от composer create-project --prefer-dist yiisoft/yii2-app-basic

/etc/apache2/sites-available/site.conf
...
ErrorLog /var/log/apache2/site.error.log
CustomLog /var/log/apache2/site.access.log common
...
логов ошибок не наблюдаю

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 15:18
ElisDN
Команда composer install не ставит сам composer, а скачивает необходимые проекту библиотеки и фреймворк в папку vendor.

Вызов composer create-project --prefer-dist yiisoft/yii2-app-basic создаёт пустой проект yii2-app-basic, а не yboard2. Проект yboard2 можно либо скачать с GitHub вручную, либо склонировать через git clone. Потом доустановить библиотеки через composer install.

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 15:44
relect
ElisDN писал(а): 2019.08.28, 15:18 Команда composer install не ставит сам composer, а скачивает необходимые проекту библиотеки и фреймворк в папку vendor.

Вызов composer create-project --prefer-dist yiisoft/yii2-app-basic создаёт пустой проект yii2-app-basic, а не yboard2. Проект yboard2 можно либо скачать с GitHub вручную, либо склонировать через git clone. Потом доустановить библиотеки через composer install.
Спасибо,

(HTTP ERROR 500) error.log
...
[Wed Aug 28 15:54:33.449622 2019] [php7:error] [pid 6745] [client myip:51997] PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /var/www/site/basic/vendor/yiisoft/yii2/base/Object.php on line 77
[Wed Aug 28 15:54:34.029717 2019] [php7:error] [pid 6746] [client myip:51996] PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /var/www/site/basic/vendor/yiisoft/yii2/base/Object.php on line 77 ...
многочисленно повторяется...

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 16:25
yiiliveext
запустите composer update

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 16:41
relect
yiiliveext писал(а): 2019.08.28, 16:25 запустите composer update
запустил, попробовал так https://www.it-rem.ru/yii2-fatal-error- ... -name.html
в Yboard2
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
Исправил на:
"require": {
"php": ">=7.3",
"yiisoft/yii2": ">=2.0.13", (такой версии не находит, с 2.0.12.2 проблема не исчезает)
"yiisoft/yii2-bootstrap": "*",
Your requirements could not be resolved to an installable set of packages.

Problem 1
- yiisoft/yii2 2.0.25 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found.
- yiisoft/yii2 2.0.24 requires bower-asset/inputmask ~3.2.2 | ~3.3.5 -> no matching package found...
найти все наследования и поменять Object на BaseObject?

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 16:51
yiiliveext
Добавьте в composer.json

Код: Выделить всё

"repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:02
ElisDN
И добавьте 'aliases' в config/web.php:

Код: Выделить всё

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
    ],
    'modules' => [
        ...

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:03
relect
yiiliveext писал(а): 2019.08.28, 16:51 Добавьте в composer.json

Код: Выделить всё

"repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]

Код: Выделить всё

[Seld\JsonLint\ParsingException]
  "./composer.json" does not contain valid JSON
  Parse error on line 13:
  ...        }    ]    "support": {
  --------------------^
  Expected one of: 'EOF', '}', ',', ']'

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:04
ElisDN
Запятую забыли.

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:19
yiiliveext
ElisDN писал(а): 2019.08.28, 17:02 И добавьте 'aliases' в config/web.php:
Тихо, мы туда еще не добрались) Сначало надо будет переименовать web.example.php

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:22
relect
ElisDN писал(а): 2019.08.28, 17:04 Запятую забыли.
добавил repositories в конец файла composer.json и запятую после ] , - не помогает.

Код: Выделить всё

{
	"repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],
}
Тихо, мы туда еще не добрались) Сначало надо будет переименовать web.example.php
в остальном коде нужно менять web.exapmle.php на web.php?
Не улавливаю связь с проблемой Object?

Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 17:56
yiiliveext
relect писал(а): 2019.08.28, 17:22
ElisDN писал(а): 2019.08.28, 17:04 Запятую забыли.
добавил repositories в конец файла composer.json и запятую после ] , - не помогает.

Код: Выделить всё

{
	"repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ],
}
Не туда

Код: Выделить всё

{
    "name": "yiisoft/yii2-app-basic",
    "description": "Yii 2 Basic Project Template",
    "keywords": ["yii2", "framework", "basic", "project template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": ">=2.0.5",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "dektrium/yii2-user": "0.9.*@dev"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ],
            "generateCookieValidationKey": [
                "config/web.php"
            ]
        },
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]
}


Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 18:01
relect
добавил, обновил:
[*]

Код: Выделить всё

 Seems you have upgraded Yii Framework from version 2.0.12.2 to 2.0.25.

  Please check the upgrade notes for possible incompatible changes
  and adjust your application code accordingly.

  ....

  Upgrade from Yii 2.0.12
  -----------------------

  * The `yii\web\Request` class allowed to determine the value of `getIsSecureConnection()` form the
    `X-Forwarded-Proto` header if the connection was made via a normal HTTP request. This behavior
    was insecure as the header could have been set by a malicious client on a non-HTTPS connection.
    With 2.0.13 Yii adds support for configuring trusted proxies. If your application runs behind a re                                                       verse proxy and relies on
    `getIsSecureConnection()` to return the value form the `X-Forwarded-Proto` header you need to expl                                                       icitly allow
    this in the Request configuration. See the [guide](http://www.yiiframework.com/doc-2.0/guide-runti                                                       me-requests.html#trusted-proxies) for more information.

    This setting also affects you when Yii is running on IIS webserver, which sets the `X-Rewrite-Url`                                                        header.
    This header is now filtered by default and must be listed in trusted hosts to be detected by Yii:

    ```php
    [   // accept X-Rewrite-Url from all hosts, as it will be set by IIS
        '/.*/' => ['X-Rewrite-Url'],
    ]
    ```

  * For compatibiliy with [PHP 7.2 which does not allow classes to be named `Object` anymore](https://                                                       wiki.php.net/rfc/object-typehint),
    we needed to rename `yii\base\Object` to `yii\base\BaseObject`.

    `yii\base\Object` still exists for backwards compatibility and will be loaded if needed in project                                                       s that are
    running on PHP <7.2. The compatibility class `yii\base\Object` extends from `yii\base\BaseObject`                                                        so if you
    have classes that extend from `yii\base\Object` these would still work.

    What does not work however will be code that relies on `instanceof` checks or `is_subclass_of()` c                                                       alls
    for `yii\base\Object` on framework classes as these do not extend `yii\base\Object` anymore but on                                                       ly
    extend from `yii\base\BaseObject`. In general such a check is not needed as there is a `yii\base\C                                                       onfigurable`
    interface you should check against instead.

    Here is a visualisation of the change (`a < b` means "b extends a"):

    ```
    Before:

    yii\base\Object < Framework Classes
    yii\base\Object < Application Classes

    After Upgrade:

    yii\base\BaseObject < Framework Classes
    yii\base\BaseObject < yii\base\Object < Application Classes

    ```

    If you want to upgrade PHP to version 7.2 in your project you need to remove all cases that extend                                                        `yii\base\Object`
    and extend from `yii\base\BaseObject` instead:

    ```
    yii\base\BaseObject < Framework Classes
    yii\base\BaseObject < Application Classes
    ```

    For extensions that have classes extending from `yii\base\Object`, to be compatible with PHP 7.2,                                                        you need to
    require `"yiisoft/yii2": "~2.0.13"` in composer.json and change affected classes to extend from `y                                                       ii\base\BaseObject`
    instead. It is not possible to allow Yii versions `<2.0.13` and be compatible with PHP 7.2 or high                                                       er.

  * A new method `public static function instance($refresh = false);` has been added to the `yii\db\Ac                                                       tiveRecordInterface` via a new
    `yii\base\StaticInstanceInterface`. This change may affect your application in the following ways:

    - If you have an `instance()` method defined in an `ActiveRecord` or `Model` class, you need to ch                                                       eck whether the behavior is
      compatible with the method added by Yii.
    - Otherwise this method is implemented in the `yii\base\Model`, so the change only affects your co                                                       de if you implement `ActiveRecordInterface`
      in a class that does not extend `Model`. You may use `yii\base\StaticInstanceTrait` to implement                                                        it.

  * Fixed built-in validator creating when model has a method with the same name.

    It is documented, that for the validation rules declared in model by `yii\base\Model::rules()`, va                                                       lidator can be either
    a built-in validator name, a method name of the model class, an anonymous function, or a validator                                                        class name.
    Before this change behavior was inconsistent with the documentation: method in the model had highe                                                       r priority, than
    a built-in validator. In case you have relied on this behavior, make sure to fix it.

  * Behavior was changed for methods `yii\base\Module::get()` and `yii\base\Module::has()` so in case                                                        when the requested
    component was not found in the current module, the parent ones will be checked for this component                                                        hierarchically.
    Considering that the root parent module is usually an application, this change can reduce calls to                                                        global `Yii::$app->get()`,
    and replace them with module-scope calls to `get()`, making code more reliable and easier to test.
    However, this change may affect your application if you have code that uses method `yii\base\Modul                                                       e::has()` in order
    to check existence of the component exactly in this specific module. In this case make sure the lo                                                       gic is not corrupted.

  * If you are using "asset" command to compress assets and your web application `assetManager` has `l                                                       inkAssets` turned on,
    make sure that "asset" command config has `linkAssets` turned on as well.

  You can find the upgrade notes for all versions online at:
  https://github.com/yiisoft/yii2/blob/2.0.25/framework/UPGRADE.md


Re: yii2 установка приложения yboard2

Добавлено: 2019.08.28, 18:05
yiiliveext
Ну все, переименовываете web.example.php в web.php, добавляете алиасы, как вам выше писали и переименовываете db.example.php в db.php