[solved] [OJS 3.1.2.4] Plugin Gallery empty

I ran it through a browser, @asmecher. Got this:

Warning: fsockopen(): SSL: Handshake timed out in C:\xampp\htdocs\journal\test.php on line 3

Warning: fsockopen(): Failed to enable crypto in C:\xampp\htdocs\journal\test.php on line 3

Warning: fsockopen(): unable to connect to ssl://pkp.sfu.ca:443 (Unknown error) in C:\xampp\htdocs\journal\test.php on line 3

Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\journal\test.php on line 4

Warning: fgets() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\journal\test.php on line 5

Warning: fclose() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\journal\test.php on line 6

Hi @Lolekbolek,

OK, that’s what I expected. So now we can replicate the problem entirely outside of OJS and it seems to be something related to your PHP OpenSSL setup. I’d suggest working through some of the leads on StackOverflow for those messages: https://stackoverflow.com/search?q=“Handshake+timed+out”+php

If you can get this working in your test script, then it should be a small step to adapt to OJS.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher, I am not sure whether it is relevant here, but on another forum someone suggested to run a test script on my dev server. The script was:

function open($mode = ‘r’) {
echo FILE . ‘:’ . LINE . “HTTPFileWrapper::open start mode ={$mode}
\n”;

	$realHost = $host = isset($this->info['host']) ? $this->info['host'] : $this->defaultHost;
	$port = isset($this->info['port']) ? (int)$this->info['port'] : $this->defaultPort;
	$path = isset($this->info['path']) ? $this->info['path'] : $this->defaultPath;
	if (isset($this->info['query'])) $path .= '?' . $this->info['query'];
	if (!empty($this->proxyHost)) {
		$realHost = $host;
		$host = $this->proxyHost;
		$port = $this->proxyPort;
		if (!empty($this->proxyUsername)) {
			$this->headers['Proxy-Authorization'] = 'Basic ' . base64_encode($this->proxyUsername . ':' . $this->proxyPassword);
		}
	}

	if (!($this->fp = fsockopen($host, $port)))
		return false;

echo FILE . ‘:’ . LINE . “HTTPFileWrapper::open socket successfully opened
\n”;

	$additionalHeadersString = '';
	if (is_array($this->headers)) foreach ($this->headers as $name => $value) {
		$additionalHeadersString .= "$name: $value\r\n";
	}

	$requestHost = preg_replace("!^.*://!", "", $realHost);
	$request = 'GET ' . (empty($this->proxyHost)?$path:$this->url) . " HTTP/1.0\r\n" .
		"Host: $requestHost\r\n" .
		$additionalHeadersString .
		"Connection: Close\r\n\r\n";
	fwrite($this->fp, $request);

	$response = fgets($this->fp, 4096);

// THIS IS THE KEY ONE
echo FILE . ‘:’ . LINE . “HTTPFileWrapper::open RESPONSE
\n”;
print_r($response);
die();
$rc = 0;
sscanf($response, “HTTP/%s %u %[^\r\n]\r\n”, $rc);
if ($rc == 200) {
while(fgets($this->fp, 4096) !== “\r\n”);
return true;
}
if(preg_match(’!^3\d\d$!’, $rc) && $this->redirects >= 1) {
for($response = ‘’, $time = time(); !feof($this->fp) && $time >= time() - 15; ) $response .= fgets($this->fp, 128);
if (preg_match(’!^(?:(?:Location)|(?:URI)|(?:location)): ([^\s]+)[\r\n]!m’, $response, $matches)) {
$this->close();
$location = $matches[1];
if (preg_match(’!^[a-z]+://!’, $location)) {
$this->url = $location;
} else {
$newPath = ($this->info[‘path’] !== ‘’ && strpos($location, ‘/’) !== 0 ? dirname($this->info[‘path’]) . ‘/’ : (strpos($location, ‘/’) === 0 ? ‘’ : ‘/’)) . $location;
$this->info[‘path’] = $newPath;
$this->url = $this->glue_url($this->info);
}
$returner =& FileWrapper::wrapper($this->url);
$returner->redirects = $this->redirects - 1;
return $returner;
}
}
$this->close();
return false;
}

===========================================================

When I ran this script in Chrome, I received a page that looked like what Plugin Gallery would load. It started like this:

FileWrapper:
C:\xampp\htdocs\journal\test2.php:451 Gallery contents

Hypothes.is GitHub - asmecher/hypothesis: A Hypothes.is integration plugin for OJS

This plugin integrates the Hypothes.is annotation tool into articles.
http://hypothes.is) in OJS articles, permitting annotation and commenting. (See the README document for notes on PDF support.)]]>

Public Knowledge Project pkp.contact@sfu.ca

https://github.com/asmecher/hypothesis/releases/download/ojs-3_0_2-0/hypothesis-ojs-3_0_2-0.tar.gz
3.0.2.0
Release of the Hypothes.is plugin for OJS 3.0.2.
https://github.com/asmecher/hypothesis/releases/download/ojs-3_1_0-0/hypothesis-ojs-3_1_0-0.tar.gz

                    3.1.0.0
                    3.1.0.1

Its source starts like this:

FileWrapper:

C:\xampp\htdocs\journal\test2.php:451 Gallery contents

<?xml version="1.0"?>

So, it’s almost like my server could talk to PKP and get info when it was using a separate script, but it doesn’t want to do it from inside OJS.

Hi @Lolekbolek,

Can you review that post and use the quoting tools to get it to display properly?

Also, where were you recommended to try that script? A link might be helpful in determining some context around the script.

Regards,
Alec Smecher
Public Knowledge Project Team

@asmecher!!! Thank you, Alec! I went through the links on the page you sent and found an advice to change default_socket_timeout=-1 in php.ini to something else. In my case, I had it set to 6000 a couple years ago, because I remember bringing it all the way up since MySQL connection was timing out when I was upgrading from OJS 2.4.5 to 3.

So, I set it to 60 and voila! Mission accomplished. The Plugin Gallery loads with all its content.

Thanks again for your help and your patience!

P.S. I can’t figured how to use quoting tools to display code snippets on this forum. Could you point me in the right direction?

Hi @Lolekbolek,

Glad to hear it’s working! Here’s a quick run-down on quoting from another Discourse-based forum: PSA: how to quote code with backticks - Meta Discussion - JuliaLang

Regards,
Alec Smecher
Public Knowledge Project Team

Million thanks, @asmecher.

Hi https://pkp.sfu.ca/ojs/xml/plugins.xml is empty. Anyone more have this problem?

Hello, we have a same problem. We have several separate ojs installation, and the plugin galery is empty for all of them. It was still available a few hours ago.

Yeah it looks down: http://pkp.sfu.ca/ojs/xml/plugins.xml

I’m in the middle of an upgrade and have dozens of broken journals. Hopefully PKP can fix it quickly :slight_smile:

i ’m in the middle of an upgrade
Hopefully PKP can fix it quickly

I figured out a temp work around if you’re in a bind. In lib/pkp/classes/plugins/PluginGalleryDAO.inc.php replace
define('PLUGIN_GALLERY_XML_URL', 'https://pkp.sfu.ca/ojs/xml/plugins.xml');
with:
define('PLUGIN_GALLERY_XML_URL', 'https://raw.githubusercontent.com/pkp/plugin-gallery/main/plugins.xml');

Just make sure to change it back to the original URL once you’ve upgraded your plugins!

Looks like http://pkp.sfu.ca/ojs/xml/plugins.xml is back!