Problem with search function
Auteur : Sven Eric A.Hello.
I did some weeks ago buy Website X5 Evo (order 114536496), installed it and transferred the website from an older Website X5 to this new SW.
Everything seemed to work and I wanted to add a Search function in the Template Content.
But when I tested this function on our web hotel server, I got the following error message:PHP Parse error: syntax error, unexpected '[' in \\atm.binero.net\content\68\143268\hammarbystrand.org\public_html\res\x5engine.php on line 1579.
It looks as a problem in the file x5engine.php, so I started to check this file.
I found when testing the code in a php tester, that it in the section labeled "//Remove PHP" it did not like the following search string "<?php".
// Remove PHP
while (stristr($file_content, "<?php") !== false) {
$php_start = imstripos($file_content, "<?php");
$php_end = imstripos($file_content, "?>", $php_start) !== false ? imstripos($file_content, "?>", $php_start) + 2 : strlen($file_content);
$php = substr($file_content, $php_start, $php_end - $php_start);
$file_content = str_replace($php, "", $file_content);
}
When I removed the ? from the text string on 2 lines, resulting in the following string “<php”, it passed the test. Unfortunately is it not possible for me to change the file x5engine, so I could check it on our normal web site (I have not the the rights to change and save the file). It works on another test server which I have access to.
Please can you help me in this matter. We really need the search function.Thanks!
Best regardsSven Eric Åberg
Sven, can you verify that you are running at least v5.6(preferably v7.2 or later) PHP.
You can usually do this thru your control panel on your web host or if necessary use live chat to have them upgrade PHP for you.
(It > En) ...!... the ADMIN https://hammarbystrand.org/admin/login.php panel does not work...
... you have no PHP support; ... as "Esahc .." said, minimum PHP/5.6+ > PHP/7+
... contact your host / server ...
...!... you are on a Microsoft-IIS/8.5 server ...
... an Apache / Linux server would be better ...
.
Auteur
Yes, the panel does not work for the moment, since they have moved it. But according to the web support it should be PHP 7.3.
Hello Sven
The search functionality seems to work fine now. I can see that you still have PHP warnings there though. These are not errors but simple warnings and you should hide them when the website goes online.
Contact your hosting provider and ask them to turn PHP warnings off. That text should then disappear from your search page
I hope I was helpful
Stefano
... now it's OK ...
.
Auteur
Hello all.
The PHP warnings looks like this:
Deprecated: Function create_function() is deprecated in /storage/content/68/143268/hammarbystrand.org/public_html/res/x5engine.php on line 4834 Deprecated: Function create_function() is deprecated in /storage/content/68/143268/hammarbystrand.org/public_html/res/x5engine.php on line 4990
I have asked the hosting provider to turn off the PHP warning as Stefano G suggested, but they don´t want to do this.
Please, can you help me in this matter so that we will not see the warnings? Either provide us with some code that disables the warnings or some other solution.
Best regards
Sven Eric Åberg
Hello Sven
Unfortunately, this is not something that the support can take of. This change should be performed directly on your hosting and for this reason, they should be able to help you out with this.
It is really weird that they seem to be unwilling to proceed with this. Unfortunately, this is currently the only way to remove the display of those warnings.
Please try to contact them again and see if there's anything they can do about those. Keep me posted here after
Thank you
Stefano
Auteur
Hello
I have asked the hosting provider once more, but they are still reluctant to do this, since according to them it should mean a change in the PHP file and they don´t want to do this. I think this is for responsibility reasons.
Their opinion is also that the command should be modifiedso that the warning does not occur at all.
Instead they say that we should do the change ourselves. What I have read (since I am not familiar with PHP), this could mean adding the following command in the PHP file:
error_reporting (E_ALL ^ E_WARNING);
My questions are:
1. Is this the right command and if so is it enough to enter only this line?
2. In which file should this command be added?
3. Do I have the access rights to be able to enter this line in the right file?
4. At which location in this file should it be entered?
Looking forward to your answer.
Best regards
Sven Eric Åberg
Hello Sven
Unfortunately, such a change implies the use of custom code for which the Staff cannot provide support. I'm really sorry about it.
If they are unwilling to make the change at the server level for you, perhaps they can give you proper direction on how to apply that line of code into your website.
I'm really sorry about being unable to help further with this matter
In any case, I would like you to know that the fact that that warning is appearing has already been notified to the developers so that it might be removed from the software in the future
Thank you for your understanding
Stefano