eureka2 / G6K

Generator of calculation simulator (calculator)
MIT License
20 stars 19 forks source link

Problem during installation #18

Open neobiz opened 5 years ago

neobiz commented 5 years ago

Hello, During the installation I have the following error message "Installing the users of the administration interface Unable to get database parameters: Unable to read the "eureka2/g6k.env" environment file."

I checked all prerequisites and I'am using composer 1.8.6, php7.1.3 on wamp 3.0.6 on Windows 10. Can you help me please ?

opportus commented 5 years ago

Hi,

From the message, I'd try copy paste the content of the .env.dist file in a new file named g6k.env in the eureka2 directory. Then, according to my environment, I'd set up the following default environment variables in it:

DB_ENGINE=sqlite
DB_NAME=g6k
DB_HOST=~
DB_PORT=~
DB_USER=~
DB_PASSWORD=~
DB_VERSION=3.15
DB_PATH=%kernel.project_dir%/var/data/databases/g6k.db
DB_CHARSET=UTF8

You may have to adapt other variables in that file…

Let us know how that would work in your case.

neobiz commented 5 years ago

Thanks for your reply, I'am using the command "php -d memory_limit=-1 composer.phar create-project eureka2/g6k simulator/ 4.*". This command create the folder simulator and inside the .env file with the database information. But at the step of create users in database I have the error message "Unable to get database parameters: Unable to read the "eureka2/g6k.env" environment file". I copied the .env file from simulator to the folder eureke/g6k and I retry the command (after delete the simulator folder). It's doesn't works better : image Have you another idea please ?

neobiz commented 5 years ago

The editor modify the .env filepath, that's why i sent the copy screen.

opportus commented 5 years ago

Looks like the Unable to get database parameters exception message is thrown around this line:

https://github.com/eureka2/G6K/blob/83ee9ee22a108952d7f74029d59e0357ae879e6e/src/G6K/Composer/ScriptHandler.php#L470

Wondering what is your $symfonyDir value. Try output the value and check if the path exists. Only an invalid path could make that code throw exception… This might also explain the Could not scan for classes... error messages... Let us know.

opportus commented 5 years ago

I only notice now… The path of the file that the $detenv component tries to load is eureka2/g6k\.env... It's a path mixing Linux and Windows type of directory separator, hence the invalid path (maybe)… But perhaps the most important is… Shouldn't the path be simulator\4.*\.env instead?

eureka2 commented 5 years ago

Hi,

There is a new problem with the installation manager of 'composer', the getInstallPath method does not returns an absolute path of the package 'eureka2/g6k' during the installation, which makes it difficult now to find the installation directory ($symfonyDir).

after this instruction: $installPath = $installationManager->getInstallPath($package); $installPath contains only 'eureka/g6k' not the full path.

I have to find a workaround to this problem.

For the moment:

@neobiz go to the simulator directory an run these two commands:

php ../composer.phar run-script g6k-scripts
php ../composer.phar run-script auto-scripts
opportus commented 5 years ago

@eureka2 What is the $symfonyDir? The root directory of the app in which the composer.json stands? If so, couldn't the Kernel::getProjectDir() be of any help here?

https://github.com/symfony/symfony/blob/0d8f5fe985aeed6145eaa1c32d265cb001275fbe/src/Symfony/Component/HttpKernel/Kernel.php#L342

eureka2 commented 5 years ago

@opportus Thanks a lot for your help but i can not use the symfony kernel in a composer script. Classes inheriting from this abstract class are only available in controllers and commands.

eureka2 commented 5 years ago

I found this workaround:

$vendorDir = $event->getComposer()->getConfig()->get('vendor-dir');
$symfonyDir = dirname($vendorDir);
neobiz commented 5 years ago

Hello,

Many thanks for the workaround, it's works perfectly and I installed the simulator with success !

I have another question, I needs to integrate the simulator in a Wordpress website and after few search I think that I will use Iframe (It's seems difficult to integrate symfony with Wordpress). In fact, I need to recover a data calculated by the simulator in order to set a product price in Woocommerce, have you some documentation about this please ?

Best regards,

iliasYassine commented 4 years ago

pleasde help me i have a big problem to install g6k Capture