簡體   English   中英

我怎樣才能用作曲家解決這個問題?

[英]How can I solve that problem with composer?

嘗試使用 Composer 安裝 codecept 文件

我有這個

D:\OpenServer\domains\opensource.php>composer require "codeception/codeception:*"./composer.json 已更新 使用 package 信息加載 composer 存儲庫 更新依賴項(包括 require-dev) 無需安裝或更新 生成自動加載文件您正在使用的 31 個軟件包正在尋找資金。 使用 composer fund 命令了解更多信息!

@php 要求.php

致命錯誤:未捕獲的 PDOException: SQLSTATE[HY000] [1045] D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db\ 中的用戶 'root'@'localhost' 的訪問被拒絕(使用密碼:NO) Connection.php:705 堆棧跟蹤:#0 D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db\Connection.php(705): PDO->__construct() #1 D:\OpenServer\domains \opensource.php\vendor\yiisoft\yii2\db\Connection.php(626): yii\db\Connection->createPdoInstance() #2 D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db \Connection.php(1022): yii\db\Connection->open() #3 D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db\Connection.php(1009): yii\db\ Connection->getMasterPdo() #4 D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db\Schema.php(696): yii\db\Connection->getSlavePdo() #5 D:\OpenServer \domains\opensource.php\vendor\yiisoft\yii2\db\Connection.php(994): yii\db\Schema->getServerVersion() #6 D:\OpenServer\domains\opensource.php\requirements.php(67 ): yii \db\Connection->getServerVersion() #7 {main}

Next yii\db\Exception: in D:\OpenServer\domains\opensource.php\vendor\yiisoft\yii2\db\Connection.php on line 637 Script @php requirements.php 處理 post-update-cmd 事件返回錯誤代碼 255

安裝失敗,正在將 ./composer.json 還原為其原始內容。

這是我的要求。php 文件

<?php
/**
 * Application requirement checker script.
 *
 * In order to run this script use the following console command:
 * php requirements.php
 *
 * In order to run this script from the web, you should copy it to the web root.
 * If you are using Linux you can create a hard link instead, using the following command:
 * ln ../requirements.php requirements.php
 */

// you may need to adjust this path to the correct Yii framework path
// uncomment and adjust the following line if Yii is not located at the default path
//$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2';


if (!isset($frameworkPath)) {
    $searchPaths = array(
        dirname(__FILE__) . '/vendor/yiisoft/yii2',
        dirname(__FILE__) . '/../vendor/yiisoft/yii2',
    );
    foreach ($searchPaths as $path) {
        if (is_dir($path)) {
            $frameworkPath = $path;
            break;
        }
    }
}

if (!isset($frameworkPath) || !is_dir($frameworkPath)) {
    $message = "<h1>Error</h1>\n\n"
        . "<p><strong>The path to yii framework seems to be incorrect.</strong></p>\n"
        . '<p>You need to install Yii framework via composer or adjust the framework path in file <abbr title="' . __FILE__ . '">' . basename(__FILE__) . "</abbr>.</p>\n"
        . '<p>Please refer to the <abbr title="' . dirname(__FILE__) . "/README.md\">README</abbr> on how to install Yii.</p>\n";

    if (!empty($_SERVER['argv'])) {
        // do not print HTML when used in console mode
        echo strip_tags($message);
    } else {
        echo $message;
    }
    exit(1);
}

require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');
$requirementsChecker = new YiiRequirementChecker();

$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.';
$gdOK = $imagickOK = false;

if (extension_loaded('imagick')) {
    $imagick = new Imagick();
    $imagickFormats = $imagick->queryFormats('PNG');
    if (in_array('PNG', $imagickFormats)) {
        $imagickOK = true;
    } else {
        $imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.';
    }
}

if (extension_loaded('gd')) {
    $gdInfo = gd_info();
    if (!empty($gdInfo['FreeType Support'])) {
        $gdOK = true;
    } else {
        $gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.';
    }
}

/**
 * Adjust requirements according to your application specifics.
 */
$requirements = array(
    // Database :
    array(
        'name' => 'PDO extension',
        'mandatory' => true,
        'condition' => extension_loaded('pdo'),
        'by' => 'All DB-related classes',
    ),
    array(
        'name' => 'PDO SQLite extension',
        'mandatory' => false,
        'condition' => extension_loaded('pdo_sqlite'),
        'by' => 'All DB-related classes',
        'memo' => 'Required for SQLite database.',
    ),
    array(
        'name' => 'PDO MySQL extension',
        'mandatory' => false,
        'condition' => extension_loaded('pdo_mysql'),
        'by' => 'All DB-related classes',
        'memo' => 'Required for MySQL database.',
    ),
    array(
        'name' => 'PDO PostgreSQL extension',
        'mandatory' => false,
        'condition' => extension_loaded('pdo_pgsql'),
        'by' => 'All DB-related classes',
        'memo' => 'Required for PostgreSQL database.',
    ),
    // Cache :
    array(
        'name' => 'Memcache extension',
        'mandatory' => false,
        'condition' => extension_loaded('memcache') || extension_loaded('memcached'),
        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html">MemCache</a>',
        'memo' => extension_loaded('memcached') ? 'To use memcached set <a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html#$useMemcached-detail">MemCache::useMemcached</a> to <code>true</code>.' : ''
    ),
    // CAPTCHA:
    array(
        'name' => 'GD PHP extension with FreeType support',
        'mandatory' => false,
        'condition' => $gdOK,
        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-captcha-captcha.html">Captcha</a>',
        'memo' => $gdMemo,
    ),
    array(
        'name' => 'ImageMagick PHP extension with PNG support',
        'mandatory' => false,
        'condition' => $imagickOK,
        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-captcha-captcha.html">Captcha</a>',
        'memo' => $imagickMemo,
    ),
    // PHP ini :
    'phpExposePhp' => array(
        'name' => 'Expose PHP',
        'mandatory' => false,
        'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),
        'by' => 'Security reasons',
        'memo' => '"expose_php" should be disabled at php.ini',
    ),
    'phpAllowUrlInclude' => array(
        'name' => 'PHP allow url include',
        'mandatory' => false,
        'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),
        'by' => 'Security reasons',
        'memo' => '"allow_url_include" should be disabled at php.ini',
    ),
    'phpSmtp' => array(
        'name' => 'PHP mail SMTP',
        'mandatory' => false,
        'condition' => strlen(ini_get('SMTP')) > 0,
        'by' => 'Email sending',
        'memo' => 'PHP mail SMTP server required',
    ),
);

// OPcache check
if (!version_compare(phpversion(), '5.5', '>=')) {
    $requirements[] = array(
        'name' => 'APC extension',
        'mandatory' => false,
        'condition' => extension_loaded('apc'),
        'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-apccache.html">ApcCache</a>',
    );
}

$result = $requirementsChecker->checkYii()->check($requirements)->getResult();
$requirementsChecker->render();
exit($result['summary']['errors'] === 0 ? 0 : 1);

這是作曲家.json

{
    "name": "opensourcewebsite/core",
    "description": "OpenSourceWebsite Core",
    "keywords": [
        "opensourcewebsite",
        "osw",
        "yii2",
        "yii",
        "php7",
        "php"
    ],
    "homepage": "https://opensourcewebsite.org",
    "type": "project",
    "license": "MIT",
    "support": {
        "issues": "https://github.com/opensourcewebsite-org/opensourcewebsite-org/issues?state=open",
        "source": "https://github.com/opensourcewebsite-org/opensourcewebsite-org"
    },
    "funding": [
        {
            "type": "opencollective",
            "url": "https://opencollective.com/opensourcewebsite"
        }
    ],
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=7.4",
        "ext-bcmath": "*",
        "ext-json": "*",
        "ext-PDO": "*",
        "ext-intl": "*",
        "ext-curl": "*",
        "ext-iconv": "*",
        "yiisoft/yii2": "~2.0.35",
        "yiisoft/yii2-swiftmailer": "^2.0",
        "almasaeed2010/adminlte": "^3.0",
        "cebe/yii2-gravatar": "^1.1",
        "vlucas/phpdotenv": "^2.5",
        "brussens/yii2-maintenance-mode": "^0.2",
        "kartik-v/yii2-widget-select2": "^2.1",
        "npm-asset/ace-builds": "^1.4.1",
        "yiisoft/yii2-httpclient": "^2.0.0",
        "telegram-bot/api": "^2.3",
        "longman/telegram-bot": "^0.61",
        "kartik-v/yii2-widget-datepicker": "^1.4",
        "janisto/yii2-timepicker": "^1.1",
        "ivankff/yii2-modal-ajax": "^4.1",
        "yiisoft/yii2-bootstrap4": "^2.0",
        "yii2tech/ar-position": "^1.0",
        "voskobovich/yii2-linker-behavior": "^4.1"
    },
    "require-dev": {
        "yiisoft/yii2-debug": "^2.0",
        "yiisoft/yii2-faker": "^2.0",
        "yiisoft/yii2-gii": "^2.0",
        "codeception/codeception": "^4.0",
        "codeception/module-asserts": "^1.0",
        "codeception/module-filesystem": "^1.0",
        "codeception/module-yii2": "^1.0",
        "codeception/specify": "^1.3",
        "codeception/verify": "^1.3",
        "fzaninotto/faker": "^1.9",
        "friendsofphp/php-cs-fixer": "^2.16"
    },
    "config": {
        "process-timeout": 1800,
        "fxp-asset": {
            "enabled": false
        },
        "platform": {
            "php": "7.4"
        }
    },
    "scripts": {
        "post-update-cmd": [
            "@php requirements.php"
        ],
        "post-install-cmd": [
            "yii\\composer\\Installer::postInstall",
            "@php requirements.php"
        ]
    },
    "extra": {
        "yii\\composer\\Installer::postInstall": {
            "generateCookieValidationKey": [
                "config/web-local.php"
            ],
            "setPermission": [
                {
                    "runtime": "0777",
                    "runtime/cache": "0777",
                    "runtime/debug": "0777",
                    "runtime/logs": "0777",
                    "runtime/mail": "0777",
                    "web/assets": "0777",
                    "yii": "0755"
                }
            ]
        }
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]
}

請幫我解決這個問題

我得到了那個問題的答案。 問題出在正確的數據庫憑據中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM