serve symfony 5 project to host machine from VMware

On my VMWARE running debian 10 I started a new project using:

composer create-project symfony/wesite-skeleton myproject

I served it using:

php -S 0.0.0.0:8987 -t public

And it worked

Trying to kickoff with the framework i created a controller and wanted to return some HTML

Now my project won't load and instead it sends

An exception occurred in driver: could not find driver

I think it has to do with the php server and tried to look into how to serve using apache: I tried using the apache-pack and didn't find the .htaccess file Some more research and i understood that apache only serves through /var/www/html

Yet I want to serve my symfony 5 project from my VMWARE debian 5 to my Windows 10 through the VM ip and a persnalised port. Please help

1 answer

  • answered 2021-04-21 18:24 Majd

    The answer is kind of clear but i think the lack of documentation has to do with how hard it is to solve it.

    • The php server is enough
    • In the .env file one HAS to setup the MySQL database using his username & password
    • Make sure you can login to your MySQL -and have a database set for your project- using a username other than root and grant that user all priviliges "Must be able to login to msql -u <user> -p without sudo.
    • Additional step and i don't know if everyone has to do so: in /etc/php/8.0/cli/php.ini at a line where there is a line ;extension=pdo_mysql you decomment this line -delete the ; and change it to extension=pdo_mysql.so to avoid the PDO driver not found Exception

    hope this helps future users