Custom Header Plugin error Failed Ajax request or invalid JSON returned [close]

I installed Custom Header Plugin but i have error Failed Ajax request or invalid JSON returned., my log is

112.215.242.239 - - [08/Mar/2019:09:55:09 +0700] “GET /index.php/tjpo/$$$call$$$/grid/settings/plugins/settings-plugin-grid/manage?verb=settings&plugin=customheaderplugin&category=generic&_=1552013692589 HTTP/1.0” 500 - “https://ojs.kuliahkomputer.com/index.php/tjpo/management/settings/website” “Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0”

I am not sure at what step @ciptoblues has this error, but I just installed Custom Header Plugin and when I click on “Settings”, I have the same “Failed Ajax request or invalid JSON returned” error. My php_error_log shows this:

[13-Mar-2019 17:06:30 America/Halifax] PHP Fatal error: Uncaught Error: Call to undefined method CustomHeaderPlugin::getTemplateResource() in C:\xampp\htdocs\journal\plugins\generic\customHeader\CustomHeaderSettingsForm.inc.php:35
Stack trace:
#0 C:\xampp\htdocs\journal\plugins\generic\customHeader\CustomHeaderPlugin.inc.php(87): CustomHeaderSettingsForm->__construct(Object(CustomHeaderPlugin), ‘8’)
#1 C:\xampp\htdocs\journal\lib\pkp\classes\controllers\grid\plugins\PluginGridHandler.inc.php(234): CustomHeaderPlugin->manage(Array, Object(Request))
#2 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPRouter.inc.php(390): PluginGridHandler->manage(Array, Object(Request))
#3 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPComponentRouter.inc.php(257): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array)
#4 C:\xampp\htdocs\journal\lib\pkp\classes\core\Dispatcher.inc.php(134): PKPComponentRouter->route(Object(Request))
#5 C:\xampp\htdocs\journal\lib\pkp\classes\core\PKPApplication.inc.php(247): Dispatcher->dispatch(Object(Request))
#6 C:\xampp\htd in C:\xampp\htdocs\journal\plugins\generic\customHeader\CustomHeaderSettingsForm.inc.php on line 35

Any idea how Ajax/JSON error is connected to this plugin?

Hi @Lolekbolek,

What version of OJS are you using, and how did you intsall the custom header plugin?

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you for the follow up, @asmecher.

I am on 3.1.1.4. Installed by downloading the zip file, unzipping it in the Generic folder, renaming by deleting “-master”, so it appears on the Plugins page, and finally clicking on “enable”. So, now it shows, but going to plugin settings gives me this error.

I had a similar error before: Can't add item "Custom Page" to Navigation Menu Items in 3.1.1.4, and changing disable_path_info Off and On and restarting Apache each time worked, but not this time.

Hi @Lolekbolek,

It sounds like you’re downloading the plugin from the wrong spot. Best is to use the Plugin Gallery to discover and install plugins. If you do download the plugin from github directly, then make sure to get it from the Releases area, checking to see that it’s listed as being compatible with your version of OJS.

Reards,
Alec Smecher
Public Knowledge Project Team

Have the same issue with fresh install of the latest 3.3.0.8 and plugin 1.0.3.1 installed from gallery with PHP 8.1
Rolling back to PHP 7.4 solved the problem. Seems that PHP 8.1 is not supported.
Regards,
Vasyl

Hi @Vasyl_Ostrovskyi,

PHP 8.1.0 has not been formally released yet, and we haven’t tested any of our applications for compatibility with it. I would recommend using PHP 8.0 (or a supported 7.x) for now.

Regards,
Alec Smecher
Public Knowledge Project Team