First installation, production environment doesn't work


#1

Hi, I just installed the Sylius distribution on my local machine and I get a HTTP Response Code 500 when I try to open app.php. The php_error.log says:

 [04-Apr-2018 20:51:04 Europe/Berlin] PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sylius.sylius_channel' doesn't exist in /Users/..../site/sylius/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:105.
 #0 /Users/..../site/sylius/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(105): PDOStatement->execute(NULL)
 #1 /Users/..../site/sylius/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(907): Doctrine\DBAL\Driver\PDOStatement->execute()
 #2 /Users/..../site/sylius/vendor/doctrine/orm/lib/Doctrine/ORM/Persisters/Entity/BasicEntityPersister.php(733): Doctrine\DBAL\Connection->executeQuery('SELECT t0.code ...', Array, Array)
 #3 /Users/..../site/sylius/vendor/doctrine/orm/lib/Doctrine/ORM/EntityRepository.php(196): Doctrine\ORM\Persisters\Entity\BasicEntityPersister->load(Array, NULL, NULL, Array, NULL, 1, NULL)
 #4 /Users/..../site/sylius in /Users/..../site/sylius/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 57

Accessing the shop via app_dev.php works mostly fine, but there are some 404 because I don’t have a _wdt folder, is that related?

Now that I’m looking at the mySQL databases, it appears there’s an empty sylius db and a fully populated sylius_dev db. So something went wrong during installation, or did I miss a crucial step to set up the prod environment?

Do you think I have the wrong database driver? I chose the default option. My dev machine is a Macbook, I run MySQL with MAMP.


#2

Did you run the command bin/console sylius:install -e prod?


#3

I did now, thank you! That wasn’t clear from the documentation.


#4

Actually environments are explained right before the installation step, for a reason: http://docs.sylius.com/en/1.1/book/introduction/environments.html


#5

@vvasiloi The documentation does not make it explicit that I have to run sylius:install separately for each environment, because it doesn’t say what install does exactly. In fact, it doesn’t even use the database name I assigned, because it will extend that with _dev. Makes sense, but not explained.

I would suggest the following addition to the installation doc:

After everything is in place, run the following commands:
$ cd acme
$ php bin/console sylius:install

This will install the dev environment. If you want to access the prod environment, you need to install it as well:
$ php bin/console sylius:install -e prod

Please note that both environments will have separate databases.

#6

It took my 5 hours to find this solution! Please add it to docs!