Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install/upgrade to PS 8.1.1 under Windows #33615

Open
2 tasks done
musicpanda opened this issue Aug 13, 2023 · 24 comments
Open
2 tasks done

Unable to install/upgrade to PS 8.1.1 under Windows #33615

musicpanda opened this issue Aug 13, 2023 · 24 comments
Labels
8.1.x Branch Autoupgrade Module: autoupgrade BO Category: Back Office Bug Type: Bug Module Module Topwatchers Backlog prioritization: issue reported & followed by +6 people Windows

Comments

@musicpanda
Copy link

musicpanda commented Aug 13, 2023

Prerequisites

Describe the bug and add attachments

When upgrading from PS 8.1 to PS 8.1.1 under Windows I got the following error: Unable to generate private keys using openssl_pkey_new. Check your OpenSSL configuration, especially the path to openssl.cafile.

PHP's Openssl module is installed and previous Prestashops versions didn't give this problem.

See also this error on the forum about a failed installation: https://www.prestashop.com/forums/topic/1079137-unable-to-generate-private-keys-using-openssl_pkey_new/
The file paths in this report suggest it is WIndows too.

Expected behavior

flawless installation

Steps to reproduce

Install PS 8.1.
Upgrade to PS 8.1.1

PrestaShop version(s) where the bug happened

8.1.1

PHP version(s) where the bug happened

7.4

If your bug is related to a module, specify its name and its version

No response

Your company or customer's name goes here (if applicable).

No response

@musicpanda musicpanda added Bug Type: Bug New New issue not yet processed by QA labels Aug 13, 2023
@Hlavtox
Copy link
Contributor

Hlavtox commented Aug 14, 2023

This is why we implemented this check, if it wasn't there, the installation would crash. You need to fix your PHP configuration. You would have problems with other things even in older versions, for example - you may not be able to download a language pack etc.

@hibatallahAouadni hibatallahAouadni added Waiting for author Status: action required, waiting for author feedback BO Category: Back Office NMI Status: issue needs more information Autoupgrade Module: autoupgrade Waiting for dev Status: action required, waiting for tech feedback Module Module 8.1.x Branch and removed New New issue not yet processed by QA labels Aug 14, 2023
@musicpanda
Copy link
Author

This is why we implemented this check, if it wasn't there, the installation would crash. You need to fix your PHP configuration. You would have problems with other things even in older versions, for example - you may not be able to download a language pack etc.

Didn't you read my submission? I explicitly mentioned that OpenSSL is installed.

It looks like some obstructionists at Prestashop have tried to "solve" the 'api_public_key' problem (see #33351).

They have added a check to D/modules/autoupgrade/classes/UpgradeSelfCheck.php that looks like
` $privateKey = openssl_pkey_new([
'private_key_bits' => 2048,
'private_key_type' => OPENSSL_KEYTYPE_RSA,
]);

    if ($privateKey === false) {
        return false;
    }

    return true;`

The function openssl_pkey_new() needs a path to openssl.cnf and it looks my Xampp installation doesn't provide that by default.

Never mind that the great majority of Prestashops doesn't have any need for public and private keys.

@prestashop-issue-bot prestashop-issue-bot bot removed the Waiting for author Status: action required, waiting for author feedback label Aug 14, 2023
@Hlavtox
Copy link
Contributor

Hlavtox commented Aug 14, 2023

@musicpanda

Didn't you read my submission? I explicitly mentioned that OpenSSL is installed.

I can read just fine, but openssl installed and enabled is not enough. You must check the paths to the certificates in php.ini, in XAMPP it's not configured correctly sometimes.

It looks like some obstructionists at Prestashop have tried to "solve" the 'api_public_key' problem

Yeah that was me, because it's better to notify the user before installing, then throwing a fatal error during the install.

Open C:\xampp\php\php.ini and check that these two values are correct:
curl.cainfo = "\xampp\apache\bin\curl-ca-bundle.crt"
openssl.cafile = "\xampp\apache\bin\curl-ca-bundle.crt"

@musicpanda
Copy link
Author

Open C:\xampp\php\php.ini and check that these two values are correct:
curl.cainfo = "\xampp\apache\bin\curl-ca-bundle.crt"
openssl.cafile = "\xampp\apache\bin\curl-ca-bundle.crt"

Yes, those values are correct in my php.ini.

I did some experiment and saw that when I add a "config" setting to the Prestashop code it will work:
$privateKey = openssl_pkey_new([ 'config' => 'C:/xampp/apache/conf/openssl.cnf', 'private_key_bits' => 2048, 'private_key_type' => OPENSSL_KEYTYPE_RSA, ]);

However, I don't know how to add that to php.ini.

@Hlavtox
Copy link
Contributor

Hlavtox commented Aug 15, 2023

@musicpanda This is my local PHP configuration, check everything that contains "openssl" and try to find what you have different. It will work fine without code modification. We can then put it into https://devdocs.prestashop-project.org/. ;-)

phpinfo.zip

@musicpanda
Copy link
Author

I ran "php -i" and I saw the following setting:

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.1.1s 1 Nov 2022
OpenSSL Header Version => OpenSSL 1.1.1s 1 Nov 2022
Openssl default config => C:\Program Files\Common Files\SSL/openssl.cnf

Obviously Xampp didn't put its files there and in fact the directory "C:\Program Files\Common Files\SSL" doesn't even exist on my computer.

What I understand is that OpenSSL takes its default directory from the time when it was compiled and the only way around that is setting a Windows environment variable (as you did with OPENSSL_CONF). Making a setting in php.ini seems impossible.

So the only viable way I see for Prestashop to get this working for Windows is to get the php.ini setting for openssl.cafile. That will give you the Apache directory and from there you can make a guess where the openssl.cfg file is located. You can check whether the file exists and then make a call setting the OPENSSL_CONF environment variable. As some people have more than one Xampp installation on their computer this should be done before each call that uses this setting.

I am not sure whether that will work for WAMP and Laragon.

@musicpanda
Copy link
Author

An alternative might be that Prestashop owns its own openssl.cnf. When I searched for openssl.cnf I notice that quite a few modules have their own version. I saw it for ps_accounts, ps_metrics, ps_eventbus and ps_checkout, although not for all versions.

@Hlavtox
Copy link
Contributor

Hlavtox commented Aug 15, 2023

@musicpanda The environment variable is set by XAMPP. Can you check? Open httpd-xampp.conf and check that you have the OPENSSL_CONF specified.

#
# XAMPP settings
#

<IfModule env_module>
    SetEnv MIBDIRS "/xampp/php/extras/mibs"
    SetEnv MYSQL_HOME "\\xampp\\mysql\\bin"
    SetEnv OPENSSL_CONF "/xampp/apache/bin/openssl.cnf" <<< THIS
...

Update, I also have it as windows environment variable.

Snímek obrazovky 2023-08-15 222540

Please try it and tell me if it fixes the issue. ;-)

@musicpanda
Copy link
Author

musicpanda commented Aug 16, 2023

No, none of these variables is set in my Windows environment.

It makes me wonder what this "IfModule env_module" checks for.

@Hlavtox
Copy link
Contributor

Hlavtox commented Aug 16, 2023

OK, so try to set OPENSSL_CONF like I have.

@musicpanda
Copy link
Author

I tried quite a few variations. But none had the effect that the PS upgrade passed the test.

@musicpanda
Copy link
Author

When I checked on Stackoverflow I noticed that more people complain that it doesn't work for them. I get the impression that it worked in the past but no longer.

@ComonSoft
Copy link
Contributor

ComonSoft commented Sep 15, 2023

Same issue under Wamp, This is clearly an issue beacause it worked in previous versions. It happens also if you configure PS in http mode (should not)!
After several researchs, seems to be a WAMP or XAMP issue. We found a workround check with phpinfo() where is located the "Openssl default config" in our case C:\Apache24\conf/openssl.cnf. If you don't know how to change this configuration just create folders path and copy openssl.cnf into.

@Hlavtox
Copy link
Contributor

Hlavtox commented Sep 15, 2023

@ComonSoft You need to properly configure your environment, I suggest getting help of a skilled Windows admin or googling. :-)

@musicpanda
Copy link
Author

@ComonSoft You need to properly configure your environment, I suggest getting help of a skilled Windows admin or googling. :-)

This reaction doesn't make sense. If you want to claim that people don't have their Windows properly configured you should specify where. Windows is not Linux: its users don't extensively configure it. Most installations look exactly the same.

@kpodemski
Copy link
Contributor

@musicpanda

We might add documentation about it, but configuration differs whether you use WAMPP, XAMPP, Laragon, or whatever other app there is on Windows.

@Hlavtox
Copy link
Contributor

Hlavtox commented Sep 15, 2023

@musicpanda The stack people are using is not correctly configured, I am sure that if you googled and we compared our configurations, it will work properly.

Windows is not Linux: its users don't extensively configure it. Most installations look exactly the same.

Yep, for normal use, but if you want to run a webserver on it, it needs some configuration. And XAMPP is not configured well for it by default.

Didn't you have to properly enable all extensions, setup opcache, memory limits etc. when you installed XAMPP? ;-)


I will try it on a clean windows PC and update the docs for steps. ;-)

@musicpanda
Copy link
Author

musicpanda commented Sep 20, 2023

Initially setting OPENSSL_CONF didn't work. But when I came back a few days later and also changed the php directory in PATH it suddenly worked. But it annoys me that all this humbug is necessary on a Windows installation that usually is meant as the experimentation copy of a life shop. It is also annoying as I have several Xampp installations for different PHP versions.

Unfortunately there are yet more serious problems. PS 8.x has serious cache problems under Windows - probably due to Symfony malfunctioning. This goes to such an extent that I am puzzled how Prestashop could adopt this. When you can't get the most basic things right under Windows I don't trust you to get anything else right. I see the below type of errors daily. Refreshing the page usually helps. But the wondering how this could happen remains:
rename

I tried PS 8.1 both as an update and a fresh installation. The update (from 8.1.0) succeeded now at once. The installation has failed four times now and the end is not in sight. And every time the error is different.

The first time the installation stopped at 67% and I got the message that the ps_edition_basic module could not be installed. Interestingly the errorlog contained a hundred messages, most about undefined constants. Amazing that it still reached 67%.

[Tue Sep 19 23:01:42.744927 2023] [php7:notice] [pid 9620:tid 1980] [client ::1:62913] PHP Notice: Constant PS_DO_NOT_LOAD_CONFIGURATION already defined in D:\xampp74g\htdocs\_ps811\install\controllers\http\smarty_compile.php on line 26, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:42.748923 2023] [php7:warn] [pid 9620:tid 1980] [client ::1:62913] PHP Warning: Use of undefined constant DB_PREFIX - assumed 'DB_PREFIX' (this will throw an Error in a future version of PHP) in D:\xampp74g\htdocs\_ps811\classes\Configuration.php on line 175, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:42.749923 2023] [php7:warn] [pid 9620:tid 1980] [client ::1:62913] PHP Warning: Use of undefined constant DB_SERVER - assumed 'DB_SERVER' (this will throw an Error in a future version of PHP) in D:\xampp74g\htdocs\_ps811\classes\db\Db.php on line 219, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:42.749923 2023] [php7:warn] [pid 9620:tid 1980] [client ::1:62913] PHP Warning: Use of undefined constant DB_USER - assumed 'DB_USER' (this will throw an Error in a future version of PHP) in D:\xampp74g\htdocs\_ps811\classes\db\Db.php on line 219, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:42.749923 2023] [php7:warn] [pid 9620:tid 1980] [client ::1:62913] PHP Warning: Use of undefined constant DB_PASSWD - assumed 'DB_PASSWD' (this will throw an Error in a future version of PHP) in D:\xampp74g\htdocs\_ps811\classes\db\Db.php on line 219, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:42.749923 2023] [php7:warn] [pid 9620:tid 1980] [client ::1:62913] PHP Warning: Use of undefined constant DB_NAME - assumed 'DB_NAME' (this will throw an Error in a future version of PHP) in D:\xampp74g\htdocs\_ps811\classes\db\Db.php on line 219, referer: http://localhost/_ps811/install/
[Tue Sep 19 23:01:45.449408 2023] [php7:error] [pid 9620:tid 1980] [client ::1:62913] PHP Fatal error: Uncaught PrestaShopException: Link to database cannot be established: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Host is onbekend. in D:\xampp74g\htdocs\_ps811\classes\db\DbPDO.php:119\nStack trace:\n#0 D:\xampp74g\htdocs\_ps811\classes\db\Db.php(331): DbPDOCore->connect()\n#1 D:\xampp74g\htdocs\_ps811\classes\db\Db.php(241): DbCore->__construct('DB_SERVER', 'DB_USER', 'DB_PASSWD', 'DB_NAME')\n#2 D:\xampp74g\htdocs\_ps811\config\alias.php(47): DbCore::getInstance()\n#3 D:\xampp74g\htdocs\_ps811\config\alias.php(52): pSQL('configuration')\n#4 D:\xampp74g\htdocs\_ps811\classes\Configuration.php(175): bqSQL('configuration')\n#5 D:\xampp74g\htdocs\_ps811\classes\Configuration.php(229): ConfigurationCore::loadConfiguration()\n#6 D:\xampp74g\htdocs\_ps811\config\smarty.config.inc.php(28): ConfigurationCore::get('PS_SMARTY_LOCAL')\n#7 D:\xampp74g\htdocs\_ps811\install\controllers\http\smarty_compile.php(37): require_once('D:\\xampp74g\\htd...')\n#8 D:\xampp74g\htdocs\_ps811\install\classes\c in D:\xampp74g\htdocs\_ps811\classes\db\DbPDO.php on line 119, referer: http://localhost/_ps811/install/

basemodule

The following times there were hardly any error messages. The second time a.o. some translation messages:

[Wed Sep 20 15:38:04.637171 2023] [php7:notice] [pid 9620:tid 1960] [client ::1:49374] PHP Notice: Trying to get property 'theme_name' of non-object in D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\appAppKernelProdContainer.php on line 2906, referer: http://localhost/install/index.php
[Wed Sep 20 15:40:50.932188 2023] [php7:warn] [pid 9620:tid 1948] [client ::1:49391] PHP Warning: require(D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\getPrestashop_Translation_TranslatorLanguageLoaderService.php): failed to open stream: No such file or directory in D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\appAppKernelProdContainer.php on line 2254, referer: http://localhost/install/index.php
[Wed Sep 20 15:40:50.932188 2023] [php7:error] [pid 9620:tid 1948] [client ::1:49391] PHP Fatal error: require(): Failed opening required 'D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\getPrestashop_Translation_TranslatorLanguageLoaderService.php' (include_path='D:\xampp\htdocs\vendor/pear/pear_exception;D:\xampp\htdocs\vendor/pear/console_getopt;D:\xampp\htdocs\vendor/pear/pear-core-minimal/src;D:\xampp\htdocs\vendor/pear/archive_tar;D:\xampp74g\php\PEAR') in D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\appAppKernelProdContainer.php on line 2254, referer: http://localhost/install/index.php
[Wed Sep 20 15:40:51.364266 2023] [php7:warn] [pid 9620:tid 1956] [client ::1:49390] PHP Warning: require(D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\getPrestashop_Translation_TranslatorLanguageLoaderService.php): failed to open stream: No such file or directory in D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\appAppKernelProdContainer.php on line 2254, referer: http://localhost/install/index.php
[Wed Sep 20 15:40:51.364266 2023] [php7:error] [pid 9620:tid 1956] [client ::1:49390] PHP Fatal error: require(): Failed opening required 'D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\getPrestashop_Translation_TranslatorLanguageLoaderService.php' (include_path='D:\xampp\htdocs\vendor/pear/pear_exception;D:\xampp\htdocs\vendor/pear/console_getopt;D:\xampp\htdocs\vendor/pear/pear-core-minimal/src;D:\xampp\htdocs\vendor/pear/archive_tar;D:\xampp74g\php\PEAR') in D:\xampp\htdocs\var\cache\prod\ContainerR8edCdg\appAppKernelProdContainer.php on line 2254, referer: http://localhost/install/index.php
[Wed Sep 20 15:42:28.966427 2023] [php7:notice] [pid 9620:tid 1960] [client ::1:49374] PHP Notice: Trying to get property 'theme_name' of non-object in D:\xampp\htdocs\var\cache\prod\ContainerNx53ry0\appAppKernelProdContainer.php on line 3435, referer: http://localhost/install/index.php

The message was:
link_block

The third time produced just like the first time a message that a module could not be installed. Only this time it concerned two modules:
install3

The fourth time I had enabled debug mode. This time I got a message that I should use at least PHP 8.1 (I use 7.4).
composer

@musicpanda
Copy link
Author

@Hlavtox
Copy link
Contributor

Hlavtox commented Sep 21, 2023

@musicpanda Firstly, glad to hear that your issue has been fixed, but we are starting to mix pears and apples. :-)

Initially setting OPENSSL_CONF didn't work. But when I came back a few days later and also changed the php directory in PATH it suddenly worked. But it annoys me that all this humbug is necessary on a Windows installation that usually is meant as the experimentation copy of a life shop.

Setting up PHP on Windows requires some configuration, you see that it was matter of one minute to set it up. It's mentioned here in the official PHP documentation. https://www.php.net/manual/en/openssl.installation.php

Prestashop has nothing to do with this.

It is also annoying as I have several Xampp installations for different PHP versions.

You can setup multiple PHP instances on xampp, then setup which folder should use which PHP version. Or there are alternatives like MAMP PRO, where you can switch versions.

Unfortunately there are yet more serious problems. PS 8.x has serious cache problems under Windows - probably due to Symfony malfunctioning. This goes to such an extent that I am puzzled how Prestashop could adopt this. When you can't get the most basic things right under Windows I don't trust you to get anything else right. I see the below type of errors daily. Refreshing the page usually helps. But the wondering how this could happen remains:

It sucks, I know, it happens to me also from time to time, but it does so only locally, so I can live with it. I never experienced it on Linux webservers. It would be cool if you could get it fixed and submit a PR for it.

Regarding the errors you sent and the link to forums, all these errors are coming from Prestashop company edition of the sofware, which we unfortunately can't control. :(

Please use the clean edition to install it - https://github.com/PrestaShop/PrestaShop/releases/tag/8.1.1, it doesn't contain any tracking, buggy modules.

@MatShir MatShir added Windows and removed Waiting for dev Status: action required, waiting for tech feedback NMI Status: issue needs more information labels Jan 17, 2024
@BenoitAdam94
Copy link

BenoitAdam94 commented Jan 22, 2024

It's still a thing

This is why we implemented this check, if it wasn't there, the installation would crash.

Implementing a check is a good thing. But you must also implement a clear and simple solution to it..

I've been using Prestashop from time to times (I mainly use Wordpress & Drupal, and I often teach PHP/SQL/CMS to students), and EVERYTIME Prestashop is the CMS giving me the hard time on local installation !!!!

I use Wamp 3.3.0 (PHP 8.1) on Windows 10

Prestashop, plz fix.

@Hlavtox
Copy link
Contributor

Hlavtox commented Jan 22, 2024

@BenoitAdam94 We can't implement tutorials to properly configure your web server environment, sorry.

@BenoitAdam94
Copy link

BenoitAdam94 commented Jan 22, 2024

@BenoitAdam94 We can't implement tutorials to properly configure your web server environment, sorry.

I can't recommend my students and my clients to use Prestashop then.

We talk about basic local windows environment here, not a random linux VPS.

@Hyblaweb
Copy link

You simply need to install OpenSSL from Shining Light Productions (slproweb.com).
You won't need to add anything on xampp or wamp.

@prestashop-issue-bot prestashop-issue-bot bot added the Topwatchers Backlog prioritization: issue reported & followed by +6 people label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.1.x Branch Autoupgrade Module: autoupgrade BO Category: Back Office Bug Type: Bug Module Module Topwatchers Backlog prioritization: issue reported & followed by +6 people Windows
Projects
None yet
Development

No branches or pull requests

8 participants