Error file_get_content

Hi :-)

We host a lot of WebUzo serveres with many Wordpress installations on, when we try to use H5P on these installations we get the following error:

When we click on libraries in admin - H5P :

Warning: file_get_contents(http://develop2.ucsj.dk/katalog/wp-content/plugins/h5p/h5p-php-library/l...): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home/uzoadmin/public_html/develop2.ucsj.dk/katalog/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php on line 2114

 

Can someone give me an hint where to look?

Kind Regards

Steffen 

icc's picture

That is really strange. It seems like the URL is returned by php's realpath(). When I try to open the link you specified it works. 

It could be that your webserver reseponds differently to your localhost. Can you try accessing the URL from a shell on your server? e.g.:
wget http://develop2.ucsj.dk/katalog/wp-content/plugins/h5p/h5p-php-library/library-support.json

You could also just "hack" around the supported libraries check by adding:
return;
after this line:
public function validateLibrarySupport($force = false) {
in h5p/h5p-php-library/h5p.classes.php.

But then be sure that you're not using really old versions of the content types from h5p.org.

 

 

Hi icc

Thanx for helping me :-)

The "hack" you suggested it not do the trick and when I try the wget command I get the following error:

 

wget http://develop2.ucsj.dk/h5/wp-content/plugins/h5p/h5p-php-library/librar...

Resolving develop2.ucsj.dk... 127.0.0.1

Connecting to develop2.ucsj.dk|127.0.0.1|:80... connected.

HTTP request sent, awaiting response... 404 Not Found

2015-02-17 05:20:29 ERROR 404: Not Found.

 

No problem with the wget command from another host.  

I have been looking everywere (I think :-) ) but can not find any config mistakes. Can you give me any hint where to look?

 

Kind regards

Steffen

 

icc's picture

First off, it seems like your server is misconfigured. Either your domain develop2.ucsj.dk should point to 130.225.168.107(not 127.0.0.1), OR your web server should listen to request from the ip address 127.0.0.1 as well. It's probaby the /etc/hosts file that maps the domain to the wrong ip.

Secondly the realpath function seems to return a url, which is indeed strange. Have the server got some kind of special file system or compiled/patched PHP?
If you could insert the following line just before line 2114 of h5p.classes.php, we might get some more debugging info:
var_dump(__FILE__); var_dump(dirname(__FILE__)); var_dump(realpath(dirname(__FILE__))); exit;

Hi,

I dont hope it is misconfigured - It is an Webuzo deployment with more that 20 wordpress installations - all in good conditions and working - a lot of plugins, themes ect. But it is on Webuzo based administration platform - so you might be right that it is not standalized according to a standalone installed apache with php.

 

It is using a standard php version 5.6 with no changes in php.ini except upload limits.

Here is the debuging information:

string(101) "/home/uzoadmin/public_html/develop2.ucsj.dk/h5/wp-content/plugins/h5p/h5p-php-library/h5p.classes.php" string(85) "/home/uzoadmin/public_html/develop2.ucsj.dk/h5/wp-content/plugins/h5p/h5p-php-library" string(85) "/home/uzoadmin/public_html/develop2.ucsj.dk/h5/wp-content/plugins/h5p/h5p-php-library"

The paths from the debug is the actual path on the linux server

 

BUT - I added the hostname with the internal ip address to the hosts file - and everything startet working :-)

 Thx again for your help :-)