我的应用程序中有一个迁移路线,当前输出是:
init migrate:install...done migrate:install
init with tables migrations...
现在它停止了。但是输出应该继续。路线如下:
Route::get('/migrate', function () {
try {
try {
echo '<br>init migrate:install...';
Artisan::call('migrate:install');
echo 'done migrate:install';
} catch (Exception $e) {
echo 'allready installed';
}
echo '<br>init with tables migrations...';
Artisan::call('migrate', array('--force' => true)); // here it stops via browser
echo 'done with migrations';
echo '<br>clear view cache...';
$cachedViewsDirectory = app('path.storage').'/framework/views/';
if ($handle = opendir($cachedViewsDirectory)) {
while (false !== ($entry = readdir($handle))) {
if(strstr($entry, '.')) continue;
@unlink($cachedViewsDirectory . $entry);
}
closedir($handle);
}
echo 'all view cache cleared';
return redirect()->route('backend::dashboard');
} catch (Exception $e) {
Response::make($e->getMessage(), 500);
}
});
在访问 Shell 并运行迁移时,它将起作用:
-bash-4.2$ /opt/plesk/php/5.6/bin/php artisan migrate
**************************************
* Application In Production! *
**************************************
Do you really wish to run this command? (yes/no) [no]:
> yes
Migrated: 2016_08_23_194102_import_old_data
Migrated: 2016_08_25_080129_import_old_adresses
Migrated: 2016_08_25_080801_import_oldname_to_accountholder
为什么它在路线上不起作用?
更新
Apache 日志显示“GET /migrate HTTP/1.0”,返回状态为 200,因此它的 HTTP OK。
同样在浏览器开发工具中没有错误。
更新 2
laravel.log 也是空的。在调用迁移路由期间没有新条目。