SimpleSearch never worked (404)

Hello everyone,

first of all - thank you for having such a community driven forum to help people figure stuff out. I’ve been banging my head against the following problem but i didn’t get very far yet.
I think that the search on this page has never worked before (i didn’t create this site) so i’m basically starting at 0.

The Problem:
SimpleSearch v2.2.2 does not work on my customers webpage using Grav v1.7.15 (Admin v1.10.15).
Whenever i search for something (f.e. “Home”) the url changes correctly as far as i can tell to “…/search/query:home”. But even if i change some things in this link around, i only get 404 pages - i never even saw a search results page.
The logs from the /wwwroot/logs folder don’t mention this plugin at all as far as i can tell.

What i’ve tried:
For now i’ve only really tried disabling the “filters” section (it’s basically standard now) in the config file attached below and updating all the plugins, my themes and GRAV itself.
I have to be honest, i’m not an expert on this topic so every tip is appreciated.

user/config/plugins/simplesearch.yaml:

    enabled: true
    built_in_css: true
    built_in_js: true
    display_button: false
    min_query_length: 3
    route: /search
    search_content: rendered
    template: simplesearch_results
    filters:
    filter_combinator: and
    ignore_accented_characters: false
    order:
        by: date
        dir: desc
    searchable_types:
        title: true
        content: true
        taxonomy: true
        header: false
    header_keys_ignored: ['title', 'taxonomy','content', 'form', 'forms', 'media_order']

I’m still figuring out how to update everything and keep it in GitHub/Azure but i guess i’ll have that in a few minutes.
In the meanwhile, if there’s any other useful information i can provide, please tell me!

Thanks in advance!

Best Regards,
Andreas

Hi @SimpleSearchFixer

**NOTE whilst writing this in a logical order, the last part was looking at simplesearch.yaml and found some ident and yaml issues , I have tided this up, so you might just want to copy and paste it FIRST and see if that resolves the error **

I am sure someone (pambattu) will be give some better advice on the whole, but from the error displayed, it looks like an issue with php and pear which is causing the initial error and the way composer / php is looking to compile.

So initial checklist
Open a terminal window on your host and change to the root of the grav install

Check for composer installation - Should be look for version =>2

composer -V  

Composer version 2.0.14 2021-05-21 17:03:37     

If not you can run the command

composer selfupdate

The next things is display and check php and pear

 php  --ini

This will display where php

R:\deliver>php --ini

Configuration File (php.ini) Path:
Loaded Configuration File:         C:\Wamp.NET\bin\.php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

This should display where the php is being loaded from, in my case, loaded from my windows stack (WAMP)

It proves that php is being found and can be accessed correctly and that my PATH command is working. If not, then you might want to find where your php installation directory is and add it to the your path statement (not too sure how you do this in azure)

Finally the thing that stands out in your error was PEAR (php package manager) and it is looking to find it in the c:\php\pear directory.

So first test in the same command line type
pear -V

R:\deliver>pear -V
PEAR Version: 1.10.12
PHP Version: 7.4.18
Zend Engine Version: 3.4.0
Running on: Windows NT DESKTOP-SDE9D8O 10.0 build 19043 (Windows 10) AMD64

This again show pear is being found, but I had to manually install pear to get it working with PHP

From your error message, the path is looking for / should be installed to PEAR

 c:\php\pear\

Open your file manager and ensure you can see a pear directory in that location (if you CANNOT see that directory or the php one, it may just be a simple path issue.

Here is a doc to ensure you get pear installed (following the pear installation steps)

Finally if all the above is ok, worth running

php bin/grav composer

which will run a check on all the vendor dependencies.


simplesearch.yaml

I have then copied and pasted your simplesearch.yaml and found a couple of error, some bad indentation, so here below is the simplesearch.yaml formatted correctly

enabled: true
built_in_css: true
built_in_js: true
display_button: false
min_query_length: 3
route: /search
search_content: rendered
template: simplesearch_results
    filters:
      filter_combinator: and
      ignore_accented_characters: false
      order:
        by: date
        dir: desc
    searchable_types:
        title: true
        content: true
        taxonomy: true
        header: false
        header_keys_ignored: ['title', 'taxonomy','content', 'form', 'forms', 'media_order']
1 Like

Thank you very much!
I’ll reply as soon as i get to check everything you wrote.

Until then - have a good day.

1 Like

Hello @spamhater,

So i’ve tried to change the /site/wwwroot/user/config/plugins/simplesearch.yaml in Azure first how you told me to but as far as i can tell it kinda crashed my whole webspace… I don’t know why 1 single file would do that and i’m not sure how to start fixing it except putting in the old one again.

The only error i can find in /LogFiles is:

[07-Jun-2021 12:21:50 UTC] PHP Fatal error: Uncaught RocketTheme\Toolbox\Compat\Yaml\Exception\ParseException: Unable to parse at line 9 (near " filters:"). in D:\home\site\wwwroot\vendor\rockettheme\toolbox\Compat\src\Yaml\Parser.php:288

To adress the other points:

Composer version 2.0.12 2021-04-01 10:14:59

D:\home\site\wwwroot>php --ini
Configuration File (php.ini) Path:
Loaded Configuration File: D:\Program Files (x86)\PHP\v7.4\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

So the composer version is alright and PHP can be loaded to. (locally for me, at least - i think?)

About that “PEAR”-Thing - so the package manager has to be installed on my machine and not on the azure webspace the page is running on?
Because if i type in 2 “pear -V” in the azure console i just get:

D:\home\site\wwwroot>pear -v
‘pear’ is not recognized as an internal or external command, operable program or batch file.

I’m following your next steps right now and update this thread as soon as i have more information.

Thank you very much again,
I hope you have a nice day!

Best Regards,
Andreas

One more thing:

Why would

c:\php\pear\

be the path i’m looking for? In the azure console i can’t access “C:/” and everything is located on “D:/” - where is it specified that pear has to be there?
It also looks like i can’t execute the pear command in the console either when i follow the guide as close as possible…

gopearphar2

@SimpleSearchFixer
mmmm Andres … lets try and break things down and get you some light.
To test your yaml files and get a bit more of debugging info, you can run

php bin/grav yamlinter

which might shed some light on all the yaml files for errors.

The big confusion seem to be with the php and pear relationship. As you said that the error display C: and you are saying that your php instal is in on D:

Part of the the pear install, it displays a list of parameters and also path integration.

I would copy the go-pear.phar file to the root of your php directory, open a command prompt window , change to your php directory then run the

 php go-pear.phar

Part of the the pear install, it displays a list of parameters and also path integration. It should detect and display relevant paths.

One thought is that you only have one copy of php installed ? Is there another one which is allocated for grav, or is running or interfering in your path, which is causing the error.

if you login in to your admin panel, goto configuration and the info tab


And check the location of php, this is the one grav is seeing.

Make sure your system path environment , type PATH at terminal console
Make sure you can see your D:\Program Files (x86)\PHP\v7.4\ (if it matches in the info page) , then you add the pear directory which should be from your path D:\Program Files (x86)\PHP; D:\Program Files (x86)\PHP\v7.4\Pear; as part of the installation it should allow you to change it.

It does sound like a slight configuration problem.

If you can copy your path statement as a in image / snapshot.

Can you give me an idea of your azure setup, is it a free account you using, as I can sign up and try and recreate the issue. (it did sound like you did have a local test server and then uploading to azures … is that correct ?)

Finally maybe I can diagnose in a joint teamviewer session if you would like.
Regards
Nick

Hello spamhater,

thanks again for your reply. I really appreciate your help with this topic - it’s super confusing for me! :mask:

Here’s the yamllinter result:
yamllinter
as far as i can tell, the error (and why the site isn’t runnnig right now probably too) is because of the compiled (?) simplesearch.yaml i’ve edited before. I’m gonna take a look at this and see if i can fix it myself.

I tried to put the go-pear.phar into the PHP Folder (“D:\Program Files (x86)\PHP”) but apparently it is not possible on azure though… So i don’t really know where else i would put it.

I can’t log into the admin panel right now because of the mentioned errors. I’ll try to get it up and running again and reach out to you ASAP! :ok_hand:

D:\home\site\wwwroot>PATH

PATH=D:\home\site\deployments\tools;D:\Program Files (x86)\SiteExtensions\Kudu\94.30524.5227\bin\Scripts;D:\Program Files (x86)\MSBuild\14.0\Bin;D:\Program Files\Git\cmd;D:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;D:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;D:\Program Files (x86)\Microsoft SDKs\F#\3.1\Framework\v4.0;D:\Program Files\Git\bin;D:\Program Files\Git\usr\bin;D:\Program Files\Git\mingw64\bin;D:\Program Files (x86)\nodejs\0.10.28;D:\Program Files (x86)\npm\1.4.28;D:\Program Files (x86)\bower\1.7.9;D:\Program Files (x86)\grunt\0.1.13;D:\Program Files (x86)\gulp\3.9.0.1;D:\Program Files (x86)\funcpack\1.0.0;D:\Python27;
D:\Program Files (x86)\PHP\v7.4;
D:\Program Files (x86)\nodejs;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0;D:\Program Files\Git\cmd;D:\Program Files\Microsoft Network Monitor 3;D:\Users\Administrator\AppData\Roaming\npm;D:\Program Files (x86)\nodejs;D:\Program Files (x86)\Mercurial;d:\Program Files (x86)\Microsoft ASPdotNET\ASPdotNET Web Pages\v1.0;;D:\Program Files (x86)\dotnet;D:\Program Files\dotnet;D:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;;E:\base\x64;E:\base\x86;;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x64;D:\Packages\GuestAgent\GuestAgent\LegacyRuntime\x86;;D:\Program Files (x86)\dotnet;D:\Program Files\dotnet;D:\Program Files\Java\zulu8.48.0.53-jre8.0.265-win_x64\bin;;D:\home\SiteExtensions\ComposerExtension\Commands;D:\local\AppData\Composer\vendor\bin

The azure setup i’m working on (DEV) is just a F1 (Free Tier) App Service Plan. As far as i know that one’s totally free.
I don’t have a local testserver but a GitHub Repository which is connected via Webhooks to Azure. So i can edit files locally and push them into the repository to update them.
Normally i just use FTP on the webspace directly to edit files or use the azure console though.

It’s an old website which had lots of changes a while ago because we changed our webspace provider.

I’d be down for a teamviewer session if you’d just do that so casually!
Let’s try to fix the first few points and then we can see when we both have time! :innocent:

Best Regards,
Andreas