douwen3127 2014-03-11 20:46
浏览 122

orm:schema-tool:create - 拒绝访问

I am trying to add Doctrine to existing custom php application. The first issue that I've faced is the following:

when trying to run

$ php vendor/bin/doctrine orm:schema-tool:create

I get Access denied.

Here is the cli-config.php file that I am using:

<?php

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Doctrine\ORM\Tools\Setup;

require_once "vendor/autoload.php";

$modelsPath = realpath(__DIR__.'/../model');
$config = Setup::createAnnotationMetadataConfiguration(array($modelsPath), true);

// database configuration parameters
$conn = array(
    'driver'   => 'pdo_mysql',
    'host'     => 'localhost',
    'user'     => 'root',
    'password' => '',
    'dbname'   => 'database',
);

return ConsoleRunner::createHelperSet(EntityManager::create($conn, $config));

Where did I go wrong?

UPDATE

  • php version is 5.4.6, OS
  • Ubuntu 12.04,
  • Doctrine Command Line Interface version 2.4.2
  • vendor/doctrine/orm/bin/doctrine file is set as executable and own by the same user as the one trying to run it

UPDATE

As per this discussion, I've been using a wrong driver. Corrections made - no effect.

  • 写回答

1条回答 默认 最新

  • douxin0251 2018-12-20 08:15
    关注

    My issue was similar but server (also Ubuntu) was running on Vagrant. Executing PHP vendor/bin/doctrine ORM:schema-tool:create was giving:

    1. Access denied (filesystem) or
    2. Connection refused [MySQL] or
    3. File not found [MySQL]
    

    Solution was to ssh to vagrant machine and execute it from there.

    评论

报告相同问题?

悬赏问题

  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥30 求解达问题(有红包)