Closed akrick closed 2 years ago
can you var_dump $argv
? add code (after $is_install = false
)
var_dump($argv);exit;
then show me the result.
$fecmall_common_main_local_config
is not define in appfront/web/install/index.php , it only define in appfront/web/index.php
why your php load appfront/web/index.php
?
Resolve:
1.appfront/web/install/index.php change all to:
<?php
ini_set("max_execution_time", "3600");
error_reporting(E_ALL & ~E_NOTICE & ~E_COMPILE_WARNING );
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'dev');
defined('FEC_INSTALL') or define('FEC_INSTALL', true);
$http = ($_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http';
$homeUrl = $http.'://'.$_SERVER['HTTP_HOST'].rtrim(dirname($_SERVER['SCRIPT_NAME']), '\\/');
require(__DIR__ . '/../../../vendor/autoload.php');
require(__DIR__ . '/../../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../../common/config/bootstrap.php');
require(__DIR__ . '/../../config/bootstrap.php');
$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../common/config/main.php'),
require(__DIR__ . '/../../../common/config/main-local.php'),
require(__DIR__ . '/../../config/main.php'),
require(__DIR__ . '/../../config/main-local.php'),
require(__DIR__ . '/../../../vendor/fancyecommerce/fecshop/app/appinstall/config/appinstall.php')
);
$config['homeUrl'] = $homeUrl.'/index.php';
$application = new yii\web\Application($config);
$application->run();
2.common/config/bootstrap.php change all to:
<?php
Yii::setAlias('@common', dirname(__DIR__));
Yii::setAlias('@console', dirname(dirname(__DIR__)).'/console');
Yii::setAlias('@appadmin', dirname(dirname(__DIR__)).'/appadmin');
Yii::setAlias('@appbdmin', dirname(dirname(__DIR__)).'/appbdmin');
Yii::setAlias('@appfa', dirname(dirname(__DIR__)).'/appfa');
Yii::setAlias('@apperp', dirname(dirname(__DIR__)).'/apperp');
Yii::setAlias('@appfront', dirname(dirname(__DIR__)).'/appfront');
Yii::setAlias('@apphtml5', dirname(dirname(__DIR__)).'/apphtml5');
Yii::setAlias('@appserver', dirname(dirname(__DIR__)).'/appserver');
Yii::setAlias('@appapi', dirname(dirname(__DIR__)).'/appapi');
Yii::setAlias('@appimage', dirname(dirname(__DIR__)).'/appimage');
//Yii::setAlias('@Facebook', dirname(dirname(__DIR__)).'/vendor/fancyecommerce/fecshop/lib/Facebook');
Yii::setAlias('@google', dirname(dirname(__DIR__)) . '/vendor/fancyecommerce/fecshop/lib/google');
// $fecmall_common_main_local_config为index.php的变量。是db 组件的配置。
Yii::setAlias('@addons', dirname(dirname(__DIR__)).'/addons');
// 下面的代码部分为:命令行执行sql初始化,不加载应用插件部分。
$is_install = false;
if (!FEC_INSTALL) {
$dbConfig = isset($fecmall_common_main_local_config['components']['db']) ? $fecmall_common_main_local_config['components']['db'] : '';
if (is_array($dbConfig) && !empty($dbConfig)) {
$connection = Yii::createObject($dbConfig);
$command = $connection->createCommand('SELECT * FROM extensions where status=:status AND installed_status=:installed_status ORDER BY priority ASC ');
$command->bindValue(':status', 1);
$command->bindValue(':installed_status', 1);
$fecmall_db_extensions_data = $command->queryAll();
}
}
then install it If the above code modification solves the problem, please reply to your results
if your have other question, contact me qq: 2358269014
when i open http://local.fecshop.com/install/, i got such an error:
Fatal error: Uncaught PDOException: PDO::__construct(): php_network_getaddresses: getaddrinfo failed: ��֪������������ in D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php:719 Stack trace: #0 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php(719): PDO->__construct('mysql:host={mys...', '{mysql_user}', '{mysql_password...', NULL) #1 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php(638): yii\db\Connection->createPdoInstance() #2 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php(1059): yii\db\Connection->open() #3 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php(1046): yii\db\Connection->getMasterPdo() #4 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Command.php(261): yii\db\Connection->getSlavePdo() #5 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Command.php(1163): yii\db\Command->prepare(true) #6 D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Command.php(410): yii\db\Command->queryInternal('fetchAll', NULL) #7 D:\wwwroot\fecmall\common\config\bootstrap.php(37): yii\db\C in D:\wwwroot\fecmall\vendor\yiisoft\yii2\db\Connection.php on line 649
then, i check it out and find: `$is_install = false; if (isset($argv) && is_array($argv)) { foreach ($argv as $av) { if ($av == '--migrationPath=@fecshop/migrations/mysqldb') { $is_install = true; break; } } }
if (!$is_install) { $dbConfig = isset($fecmall_common_main_local_config['components']['db']) ? $fecmall_common_main_local_config['components']['db'] : ''; if (is_array($dbConfig) && !empty($dbConfig)) { $connection = Yii::createObject($dbConfig); $command = $connection->createCommand('SELECT * FROM extensions where status=:status AND installed_status=:installed_status ORDER BY priority ASC '); $command->bindValue(':status', 1); $command->bindValue(':installed_status', 1); $fecmall_db_extensions_data = $command->queryAll(); } }`
But i still hadn't fill the installed form for DB connection, why there is a db connection needed? it weirded.....