Hello Forum, hello developers,
after setting up SMF 2.0.17 and doing some administration tasks I found many errors like these:
[Mon Feb 01 10:13:12.210022 2021] [php7:error] [pid 69504] [client 82.113.106.93:14509] PHP Fatal error: Maximum execution time of 300 seconds exceeded in <vhost-path>/htdocs/Sources/Subs-Db-postgresql.php on line 390, referer: https://<domain.tld/
When I look in the script code I find this endless loop:
while (true)
{
$pos1 = strpos($db_string, '\'', $pos + 1);
$pos2 = strpos($db_string, '\\', $pos + 1);
if ($pos1 === false)
break;
elseif ($pos2 == false || $pos2 > $pos1)
{
$pos = $pos1;
break;
}
$pos = $pos2 + 1;
}
How to solve this problem?
I'm running SMF 2.0.17 on FreeBSD 11.4, PHP 7.4 and PostgreSQL 12.2
Best regards
JueDan
well, not sure about the error itself, but 2.0.17 does not support php 7.4
Kindred is correct, need to drop the php version.
To be honest, we have extremely few pg users on 2.0, but it works fine in my testing on pg10.
I doubt we have
any pg users on 12... This may be new territory here...
A couple of other notes that may help:
1) From the install requirements, make sure you have standard_conforming_strings off:
QuotePostgreSQL 8.0 or higher (standard_conforming_strings must be set to off, starting from PostgreSQL 9.1 default is on)
https://wiki.simplemachines.org/smf/SMF2.0:Requirements_and_recommendations
2) You need to tell pg that SMF is already UTF8 compliant, by changing two settings. Yes, this needs to be done by hand for pg in 2.0. In settings.php, add the following line (if not already there):
$db_character_set = 'utf8';
In the smf_settings table, add the following entry (if not already there):
variable: global_character_set
value: UTF-8
3) That logic is standard query-cleansing (strips whitespace) & has been used by both mysql & pg since, forever...
If the above steps do not fix the problem, I believe that particular check will be disabled if you set the following in the smf_settings table:
variable: disableQueryCheck
value: 1
smf 2.1 got
instead of
elseif ($pos2 == false || $pos2 > $pos1)
elseif ($pos2 === false || $pos2 > $pos1)
duno if this would do the trick.
also smf 2.1 got many pg optimization.
Thanks to all.
The tip from albertlast solved the problem.
Best regards
JueDan
Nice, good to know!