Allow_url_fopen issue

Hi,

I have an installation of 3.0.1. When I try plugins tab in Website setting, I get below errors in the log file:
failed to open stream: HTTP request failed!
failed to load external entity http://pkp.sfu.ca/ojs/xml/plugins.xml

And plugin gallery tab doesn’t show any content but a Loading… text

I have set proxy configuration (http_host and http_proxy) in config file. The entire http://pkp.sfu.ca/* domain is allowed in this proxy. I have tried both On and Off for allow_url_fopen. Neither helped.

Plugin.xml file is tried to be loaded by DOMDocument->load. I read somewhere that allow_url_fopen needs to be On in order to let it work. However in the description for [proxy] in config file it says allow_url_fopen needs to Off. It is On in my php.ini.

Regards
Ghazal

This is a bug.

If your site requires a proxy to access the internet, you will not be able to load this XML file from PKP. There is no use of the proxy configuration in the code:

The documentation within the config.inc.php regarding the use of the proxy configuration appears to be correct, if confusing.

If “allow_fopen” is enabled by PHP and the identically named setting is enabled in config.inc.php, OJS will attempt a direct fopen() call for standard remote url requests:

If “allow_fopen” is disabled by PHP, or if the identically named setting is disabled in config.inc.php (the default) OJS will use specialized classes which also allow for the use of the proxy settings from config.inc.php (for HTTP and HTTPS requests).

The solution here is probably to fetch the plugins.xml file via the FileWrapper class, and then DOMDocument->load() the fetched file.

@salehig, if you are comfortable with PHP and/or Git, could you test out this change?

You will need to have “allow_url_fopen” as “Off” in your config.inc.php.

1 Like

Hi @ctgraham.

Thanks for the explanation. Yes the change above worked for me which is good.
I had also managed to make it run using the proxy in the thread Error in loading installed plugins - #11 by salehig.

Best Regards
Ghazal

1 Like

I have same issue. Will you kindly let me know in which file should I change these codes.