Prestashop: error after upgrade to 1.7.6.0

Created on 10 Jul 2019  路  47Comments  路  Source: PrestaShop/PrestaShop

ubuntu 18.4
upload zip into admin/autoupgrade, after all upgrade I've this error
https://nimb.ws/SdoxMU
attached the admin/autoupgrade/tmp
log.txt
Now accessing on admin, always...
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

1.7.6.0 Autoupgrade Bug No change required

Most helpful comment

That's weird because when we check the concerned "bootstrap.php", we see:

[...]

if ($lastParametersModificationTime) {
    $cachedParameters = _PS_CACHE_DIR_. 'appParameters.php';

    $lastParametersCacheModificationTime = (int)@filemtime($cachedParameters);
    if (!$lastParametersCacheModificationTime || $lastParametersCacheModificationTime < $lastParametersModificationTime) {
        // When parameters file is available, update its cache if it is stale.
        if (file_exists($phpParametersFilepath)) {
            $config = require $phpParametersFilepath;
            $exportPhpConfigFile($config, $cachedParameters);
        } elseif (file_exists($yamlParametersFilepath)) {
            $config = Yaml::parse($yamlParametersFilepath);
            $exportPhpConfigFile($config, $cachedParameters);
        }
    }

    $config = require_once _PS_CACHE_DIR_ . 'appParameters.php'; # <- ERROR THROWN HERE
    array_walk($config['parameters'], function (&$param) {
        $param = str_replace('%%', '%', $param);
    });
[...]

The file is supposed to be generated if it does not exist or if it is older than the parameters.php. This means the PHP cannot access the file, although it exists.

All 47 comments

Hi @centoasa,

Did you make an upgrade to PS1.7.6.0 using the 1-click upgrade v4.9.0? using the Local archive mode?
Could you please try to clear the cache manually by deleting all the folder into var/cache (prod & dev).
Thanks to check and feedback.

I had to use the local archive because, even now, PS tells me that my version 1.7.5.2 is still the most up to date.
First of update I've manually delete var/cache/prod folder.
Now I'm working on my PS webshop, because tonight I've restored my whole website backup.

@centoasa, there's a small delay between the 1.7.6.0 release and its availability in the autoupgrade.
The delay is usually 24 hours.

So, you just make a back up to the last version PS1.7.5.2?
Thanks!

@khouloudbelguith I'm using 1.7.5.2 restored from a previous backup.
have you seen the log? why the last error
[2019-07-10 19:48:09] [INTERNAL] /var/www/vhosts/100asa.it/httpdocs/config/bootstrap.php line 87 - require_once(): Failed opening required '/var/www/vhosts/100asa.it/httpdocs/var/cache/prod/appParameters.php' (include_path='/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear_exception:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/console_getopt:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear-core-minimal/src:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/archive_tar:.:/opt/plesk/php/7.2/share/pear') caused me the error 500 on backoffice, and not being able to use it anymore?

@centoasa, you just have those errors previously: https://github.com/PrestaShop/PrestaShop/issues/13355#issuecomment-498961164
It is a Symfony cache.
You need to remove the cache manually & refresh the Back office page & the FO.

Thanks!

Hi @centoasa
Maybe you can try running this command rm -fR ./var/cache/* && ./bin/console cache:clear --env=prod && ./bin/console cache:clear
This will remove your cache and perform a warmup of the Symfony cach (including the appParameters.php file), if it doesn't work it might be because of a permission problem preventing you from writing (be careful your user and the server user have compatible rights)

Also check the permission on the folder are correct. By calling some commande from a terminal, you may get the wrong user and PHP won't be able to read / modify on the cache.

@jolelievre my /var/cache/ directory have 777 and remigio/psacln
appparameters.php have 644
@khouloudbelguith those settings are right?

Using 777 rights is not a good practice, because it lets anyone read/write/access your folder
That said it should work now if you ran the command, do you still have the issue?

@jolelievre run command, with -bash: ./bin/console: Permission denied
/bin/console have 644 (as default) so I've to first change it to higher permission and after run command?

No need to change the permission if it is 644 you can call it with php instead: php ./bin/console cache:clear
It's actually safer to do it this as it should work on most environments (I'm just just to execute this script directly)

@khouloudbelguith do you suggest upgrade to 1.7.6.0 via oneclick 4.9 or local archive? what's the better for ensure better results?

@centoasa, in my case, I tried to upgrade to PS1.7.6.0 using the local archive & the 1-click upgrade v4.9.0.
In the two cases, the upgrade is well done.
In order to avoid problems, remember not to change core files, check the compatibility of your modules and theme beforehand, and test the upgrade on a separate machine from your production.
Thanks!

@khouloudbelguith @jolelievre
:-(
step to reproduce my issue-->debian 9.9 with php 7.2.20-->
login into colsole as root;
run via console rm -fR ./var/cache/*
php ./bin/console cache:clear --env=prod
php ./bin/console cache:clear
cache cleared OK
upgrade via oneclick 4.9, at the end of upgrade, when was to upgrade database.....
[INTERNAL] /var/www/vhosts/100asa.it/httpdocs/config/bootstrap.php line 87 - require_once(): Failed opening required '/var/www/vhosts/100asa.it/httpdocs/var/cache/prod/appParameters.php' (include_path='/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear_exception:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/console_getopt:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear-core-minimal/src:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/archive_tar:.:/opt/plesk/php/7.2/share/pear')
and my prestashop stuck and my admin show always the message:
Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

@centoasa, after having this error, did you tried to clear cache manually?

Thanks!

@khouloudbelguith yes, sure, many times, but nothing. Issue remain.
I think the very issue is on database, because the server stuck just while on ....database upgrade

Ping @Quetzacoalt91, @PrestaShop/prestashop-core-developers what do you think?

Thanks!

That's weird because when we check the concerned "bootstrap.php", we see:

[...]

if ($lastParametersModificationTime) {
    $cachedParameters = _PS_CACHE_DIR_. 'appParameters.php';

    $lastParametersCacheModificationTime = (int)@filemtime($cachedParameters);
    if (!$lastParametersCacheModificationTime || $lastParametersCacheModificationTime < $lastParametersModificationTime) {
        // When parameters file is available, update its cache if it is stale.
        if (file_exists($phpParametersFilepath)) {
            $config = require $phpParametersFilepath;
            $exportPhpConfigFile($config, $cachedParameters);
        } elseif (file_exists($yamlParametersFilepath)) {
            $config = Yaml::parse($yamlParametersFilepath);
            $exportPhpConfigFile($config, $cachedParameters);
        }
    }

    $config = require_once _PS_CACHE_DIR_ . 'appParameters.php'; # <- ERROR THROWN HERE
    array_walk($config['parameters'], function (&$param) {
        $param = str_replace('%%', '%', $param);
    });
[...]

The file is supposed to be generated if it does not exist or if it is older than the parameters.php. This means the PHP cannot access the file, although it exists.

I had the same error in the logs after new installation of 1.7.6.
I could solve the problem with the following steps:

  • delete symfony cache in console
  • set rights 777 to var/cache

Then Backoffice and Frontend worked immediately.

My Prestashop 1.7.5.2 say still my version is update!
https://nimb.ws/EpoQZt

No need to change the permission if it is 644 you can call it with php instead: php ./bin/console cache:clear
It's actually safer to do it this as it should work on most environments (I'm just just to execute this script directly)

@jolelievre login into console as root, after your suggested commands, folder prod have root/root user/group permission
Is this right or wrong?

You shouldn't use this command as root (actually you should never login as root unless you need to install things on your server and know exactly what you're doing) Because it will generate your cache files with root ownership and then your server is unable to access or modify them

I don't know about your server settings so I can't be sure but you should use either a user which has the same group as your server user (www, apache, ...) Or you can try login as the same user as your server Lastly you can try running the script with your user and then perform a chown on your cache files

But honestly it appears you are not very familiar with these kind of manipulations, so I wouldn't advise you trying something you don't really understand I hope you are not doing all these manipulations on a production website?

When delete /var/cache/prod folder manually, it recreate with user/group of the server (not root).
So I've do it.
Thanks @jolelievre

why still today my prestashop 1.7.5.2 is show aas "product update"?
https://nimb.ws/Aq9Qr5

I tried once again to upgrade to 1.7.6 but I still have the same problem: [INTERNAL] /var/www/vhosts/100asa.it/httpdocs/config/bootstrap.php line 87 - require_once(): Failed opening required '/var/www/vhosts/100asa.it/httpdocs/var/cache/prod/appParameters.php' (include_path='/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear_exception:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/console_getopt:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear-core-minimal/src:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/archive_tar:.:/opt/plesk/php/7.2/share/pear')
after I clear manually /var/cache/* login screen appear well, but after login I'矛ve always: Oops! An Error Occurred
The server returned a "500 Internal Server Error".
Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

@centoasa, did you tried to clear cache manually as before or not?

Thanks!

as I wrote, I've deleted cache manually first of update, and after too

I'm sorry, I forgot: this time I upgraded directly from 1click v4.9.0

Tryed again, after all, I've enabled debug and found:

(1/1)聽PrestaShopDatabaseExceptionTable 'prestashop_5.ps_currency_lang' doesn't exist

SELECT *FROM ps_currency_langWHERE id_currency = 1

in聽Db.php聽line 769
at聽DbCore->displayError('SELECT * FROM ps_currency_lang WHERE id_currency = 1')in聽Db.php聽line 385
at聽DbCore->query('SELECT * FROM ps_currency_lang WHERE id_currency = 1')in聽Db.php聽line 613
at聽DbCore->executeS('SELECT * FROM ps_currency_lang WHERE id_currency = 1')in聽EntityMapper.php聽line 82
at聽EntityMapper->load('1',聽null,聽object(Currency),聽array('table' => 'currency', 'primary' => 'id_currency', 'multilang' =>聽true, 'fields' =>聽array('iso_code' =>array('type' => 3, 'validate' => 'isLanguageIsoCode', 'required' =>聽true, 'size' => 3), 'numeric_iso_code' =>聽array('type' => 3, 'validate' => 'isNumericIsoCode', 'size' => 3), 'precision' =>聽array('type' => 1, 'validate' => 'isInt'), 'conversion_rate' =>聽array('type' => 4, 'validate' => 'isUnsignedFloat', 'required' =>聽true, 'shop' =>聽true), 'deleted' =>聽array('type' => 2, 'validate' => 'isBool'), 'active' =>聽array('type' => 2, 'validate' => 'isBool'), 'name' =>聽array('type' => 3, 'lang' =>聽true, 'validate' => 'isGenericName', 'size' => 255), 'symbol' =>聽array('type' => 3, 'lang' =>聽true, 'size' => 255)), 'classname' => 'Currency', 'associations' =>聽array('l' =>聽array('type' => 2, 'field' => 'id_currency', 'foreign_field' => 'id_currency'))), 1,聽true)in聽ObjectModel.php聽line 264
at聽ObjectModelCore->__construct('1',聽null,聽null)in聽Currency.php聽line 177
at聽CurrencyCore->__construct('1')in聽AdminController.php聽line 2950
at聽AdminControllerCore->initShopContext()in聽AdminController.php聽line 535
at聽AdminControllerCore->__construct()in聽LegacyContext.php聽line 85
at聽LegacyContext->getContext()in聽UserLocaleListener.php聽line 39
at聽UserLocaleListener->__construct(object(LegacyContext))in聽appDevDebugProjectContainer.php聽line 2381
at聽appDevDebugProjectContainer->getPrestashop_UserLocale_ListenerService()in聽appDevDebugProjectContainer.php聽line 2868
at聽appDevDebugProjectContainer->ContainerJjgaxyi{closure}()in聽EventDispatcher.php聽line 229
at聽EventDispatcher->sortListeners('kernel.request')in聽EventDispatcher.php聽line 61
at聽EventDispatcher->getListeners('kernel.request')in聽ContainerAwareEventDispatcher.php聽line 128
at聽ContainerAwareEventDispatcher->getListeners('kernel.request')in聽TraceableEventDispatcher.php聽line 262
at聽TraceableEventDispatcher->preProcess('kernel.request')in聽TraceableEventDispatcher.php聽line 137
at聽TraceableEventDispatcher->dispatch('kernel.request',聽object(GetResponseEvent))in聽HttpKernel.php聽line 127
at聽HttpKernel->handleRaw(object(Request), 1)in聽HttpKernel.php聽line 68
at聽HttpKernel->handle(object(Request), 1,聽false)in聽Kernel.php聽line 200
at聽Kernel->handle(object(Request), 1,聽false)in聽index.php聽line 86

@centoasa, this issue is fixed with this PR: https://github.com/PrestaShop/PrestaShop/pull/14620
Your issue is duplicate of https://github.com/PrestaShop/PrestaShop/issues/14617

Thanks!

Sorry, I'm confused! but debug say into my db is missing the table ps_currency_lang (I've cecked and it's missing). The #14620 talk about other files. I'm wrong?
where I can found the list of all table of db for 1.7.6, to compare mine?

@centoasa, it is the same error log reported here: https://github.com/PrestaShop/PrestaShop/issues/14617#issuecomment-510884731
And this PR: https://github.com/PrestaShop/PrestaShop/pull/14620 fixes this issue.
Thanks!

:-) @khouloudbelguith I'm very sorry. The #14620 talk about changes into install/upgrade/upgrade.php (it's right?). But now with my 1.7.5.2 ver. I've no install directory? So?

@centoasa, those fixes are added in the next release 1.7.6.1: the Major version & not the previous version.

Thanks!

but first you tell me that # 14620 fixes my problem, then you tell me that these solutions will be included in the next release. So how can I upgrade to 1.7.6 now?

download original release of 1.7.6.0, update upgrade.php file as described in #14620, zip again all the prestashop folder, put it into admin/autoupgrade/download
Tried also with unzipped folder into /latest, same error:
Analyzing the situation...Shop deactivated. Extracting files...
File extraction complete. Removing sample files...

Downloading step has been skipped, upgrade process will now unzip the local archive.
Starting upgrade...
"/latest" directory has been emptied
Content of archive /var/www/vhosts/100asa.it/httpdocs/Back100asa/autoupgrade/download/presta176.zip is extracted
errori
Could not assert the folder /var/www/vhosts/100asa.it/httpdocs/Back100asa/autoupgrade/latest contains a valid PrestaShop release, exiting.
A file may be missing, or the release is stored in a subfolder by mistake.

@centoasa, in my case, I tested this PR: https://github.com/PrestaShop/PrestaShop/pull/14620 & it is OK.
The shop well upgraded from PS1.7.5.2 to the new version PS1.7.6.1 following these steps:

  • PS1.7.5.2 installed
  • Install the autoupgrade module
  • Create a release from the PR
  • Put it in the folder admin / autoupgrade / download
  • in the configuration page of the module select "local archive" as a channel
  • Specify the version to which we are upgrading (example: 1.7.6.1)

Thanks!

@khouloudbelguith
maybe my error was because I've specified the version to which I'm upgrading to 1.7.6.0?
p.s.: the autoupgrade module you mean the 1click module?

@centoasa, it could be or a problem in the zip file.
Yes, it is the 1-click upgrade module.

Thanks!

@khouloudbelguith can you send me your zip release?

tried again and again and gain, with the same error. when 1click being update database same error appear and stuck the sever:

@centoasa, in my case, I tested this PR: #14620 & it is OK.
The shop well upgraded from PS1.7.5.2 to the new version PS1.7.6.1 following these steps:

  • PS1.7.5.2 installed
  • Install the autoupgrade module
  • Create a release from the PR
  • Put it in the folder admin / autoupgrade / download
  • in the configuration page of the module select "local archive" as a channel
  • Specify the version to which we are upgrading (example: 1.7.6.1)

Thanks!

follow as you, tried again and again and gain, with the same error. when 1click being update database same error appear and stuck the sever: [INTERNAL] /var/www/vhosts/100asa.it/httpdocs/config/bootstrap.php line 87 - require_once(): Failed opening required '/var/www/vhosts/100asa.it/httpdocs/var/cache/prod/appParameters.php' (include_path='/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear_exception:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/console_getopt:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/pear-core-minimal/src:/var/www/vhosts/100asa.it/httpdocs/vendor/pear/archive_tar:.:/opt/plesk/php/7.2/share/pear')
@khouloudbelguith have you used php 7.2.20?

@centoasa, no, I used PHP7.0.33

@khouloudbelguith Finally, the light!
Solution was the php 7.1.30 (my debian installation 9.9 has deprecated the 7.0.33)
So, Prestashop 1.7.6 and php 7.2.20 they don't get along very well :-)

@centoasa, I tried with PHP version: 7.2.13 & it is OK.
I attached a screen record
https://drive.google.com/file/d/1cjlUJv51arw5-raMmmCo8ZPBltBHa_eo/view
Since it is fixed, I close the issue, feel free to open a new one when needed.

Thanks!

Now I've changed php to 7.2.20 (the last my plesk vps have onboard) and seems alla works well. We need to find out why the auto upgrade did not work with 7.2.20.

This issue is still happening.

Was this page helpful?
0 / 5 - 0 ratings