How can I get a database running on Symfony(如何让数据库在 Symfony 上运行)
问题描述
目标:
我正在尝试使用 Symfony 中的学说简单地创建一个数据库.我的项目安装在 xampp>htdocs
我已经尝试过:
我的 apache 服务器正在运行,可以在本地查看我的网站没问题.
当我按照
解决方案:
Windows 10 在 Xampp 文件夹中有两个文件,文件名为.ini".扩展,也不是你需要的.取消注释其中的内容对我没有任何帮助.它不会添加模块.
在 Windows 10 上,您需要查看C:Xamppphp"对于名为配置"的文件.它与 ini 文件完全一样,但没有扩展名.编辑该文件将启用模块.
感谢大家为回答我的问题付出的所有努力.你基本上都是对的.似乎只是缺少 Windows 10 的命名约定.
OBJECTIVE:
I am trying to simply create a database using doctrine in Symfony. I have my project installed in xampp>htdocs
I HAVE TRIED:
I have the apache server running and can view my site locally no problem.
When I follow the instructions in the documentation, I am able to successfully run these two commands:
composer require symfony/orm-pack
composer require --dev symfony/maker-bundle
I then go to my .env file and change this line:
DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7"
to be this line:
DATABASE_URL=mysql://root:pass@127.0.0.1:3306/symphart
-I have configured the root user to use the password "pass" and haved logged in to phpmyadmin -successfully.
-php.ini-production and php.ini-development both have pdo_mysql enabled
THE PROBLEM:
When I run the command:
php bin/console doctrine:database:create
I get the error:
C:xampphtdocssymphart>php bin/console doctrine:database:create
[error] Error thrown while running command "doctrine:database:create". Message: "An exception occurred in driver: could not find driver"
In AbstractMySQLDriver.php line 128:
An exception occurred in driver: could not find driver
In Exception.php line 18:
could not find driver
In PDOConnection.php line 37:
could not find driver
Here is a screenshot of the error message:
SOLUTION:
Windows 10 has two files in the Xampp folder with the ".ini" extension, and neither are what you need. Uncommenting stuff in them did nothing for me. It wouldn't add modules.
On windows 10 you need to look in "C:Xamppphp" for a file called "configuration". It's exactly like an ini file but has no extension. Editing THAT file will enable modules.
Thanks for all the effort everyone put into answering my question. You were all essentially right. Just missing the naming convention for Windows 10 it seems.
这篇关于如何让数据库在 Symfony 上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何让数据库在 Symfony 上运行


基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 如何替换eregi() 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01