When I click on the clear cache button, I got the following error message this happen in both prestashop 1.7.7-beta1 and 1.7.6.5
Fatal error: Uncaught Error: Class 'Tools' not found in /home/admin/domains/server.com/public_html/www/classes/db/Db.php:794 Stack trace: #0 /home/admin/domains/server.com/public_html/www/config/alias.php(47): DbCore->escape('configuration', false) #1 /home/admin/domains/server.com/public_html/www/config/alias.php(52): pSQL('configuration') #2 /home/admin/domains/server.com/public_html/www/classes/Configuration.php(155): bqSQL('configuration') #3 /home/admin/domains/server.com/public_html/www/classes/Configuration.php(209): ConfigurationCore::loadConfiguration() #4 /home/admin/domains/lozserverra.com/public_html/www/classes/PrestaShopAutoload.php(171): ConfigurationCore::get('PS_DISABLE_OVER...') #5 /home/admin/domains/server.com/public_html/www/classes/PrestaShopAutoload.php(130): PrestaShopAutoload->generateIndex() #6 [internal function]: PrestaShopAutoload->load('Tools') #7 /home/admin/domains/server.com/public_html/www/config/config.inc.php(84): spl_autoload_call('Tools') #8 /home/admin/domains/l in /home/admin/domains/server.com/public_html/www/classes/db/Db.php on line 794
I saw a similar issue but it was closed without any official way how to solve this issue and no pull request was submitted: https://github.com/PrestaShop/PrestaShop/issues/12667 .
====================
My biggest guess here, perhaps php-fpm is having compatibility issue with the prestashop cache? But it's written in the documentation that we could use php-fpm. I open this issue for anyone to look into this issue and submit PR because whenever I download new fresh prestashop, I have to do this to fix it temporarily. This workaround was mentioned by @r1si
fix with change this line:
line 797 file classes/db/DB.php
change line 796:
$string = strip_tags(Tools::nl2br($string));
with this:
$string = str_replace(array("\r\n", "\r", "\n", AddressFormat::FORMAT_NEW_LINE, PHP_EOL), '
', $string);
But if you look at the date, this issue has been reported since february 2019. 1 year++, maybe not many people are using php-fpm and apache_nginx as reverse proxy ?
extra information: this is my php.ini for both php72 and php73:
allow_url_fopen=On
allow_url_include=Off
date.timezone=Asia/Kuala_Lumpur
display_errors=Off
magic_quotes_gpc=Off
max_execution_time=300
max_input_time=300
max_input_vars=20000
memory_limit=368M
post_max_size=128M
session.auto_start=Off
short_open_tag=Off
upload_max_filesize=128M
Ok this is the information from psphpinfo.php (everything is green):
Thanks for opening this issue! We will help you to keep its state consistent
@PrestaShop/prestashop-core-developers could you check this issue ?
@sarahdib It's the same as this. https://github.com/PrestaShop/PrestaShop/issues/11105
Soon, we will celebrate a 3 year aniversary of clearing cache not working. 馃槃
Duplicate of #11105
@arafatx Your issue is a duplicate of the issue mentionned above, please follow it
No, #11105 is different issue. It's about clicking the cache button twice but this issue is different where some suspect php-fpm compatibility issue. I have mentioned in the first post that my issue was duplicated from here: #12667 and a solution has been given temporarily by @r1si but no pull request has been made since feb 2019. You are closing the same unresolved issue. Please wait for somebody to do pull request and you can happily close this.
Most helpful comment
No, #11105 is different issue. It's about clicking the cache button twice but this issue is different where some suspect php-fpm compatibility issue. I have mentioned in the first post that my issue was duplicated from here: #12667 and a solution has been given temporarily by @r1si but no pull request has been made since feb 2019. You are closing the same unresolved issue. Please wait for somebody to do pull request and you can happily close this.