skip to Main Content

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:[email protected]:3306/db_name?serverVersion=5.7"

to be this line:

DATABASE_URL=mysql://root:[email protected]: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:
error message screenshot

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. First: The best practice is to use Symfony server. download Symfony from Symfony site.

    Second: The right way is to have an outsider version of PHP not related to xammp or something else. and make sure you added the right path for PHP in system variables.

    Download it from here:
    https://www.php.net/downloads.php
    Then enable the extensions in .ini file.

    For being sure that you are using the right PHP version reinstall composer and select the right path for PHP during the install process.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search