Page 1 of 1

Problem with printing module

Posted: Sat Aug 22, 2009 10:54 pm
by oliver341
Hi,

When I try printing a page with the Printing Module (using "Print this page") I get a blank page.

On further investigation, it appears my webhost does not allow:

Code: Select all

file_get_contents("http://www.mysite.co.uk/test.txt")
It returns "Connection Refused" in the Apache error log.

However it does seem to allow:

Code: Select all

file_get_contents("test.txt")
Is there anything I can do about this, or does this issue mean the Printing Module must be disabled on my site?

Thanks.

Re: Problem with printing module

Posted: Fri Oct 02, 2009 10:41 pm
by studip101
try setting allow_url_fopen to 1 in your php.ini file

Re: Problem with printing module

Posted: Fri Oct 02, 2009 11:31 pm
by oliver341
I checked the allow_url_fopen option and it was enabled. However it seems my webhost does not allow the server to connect to itself, so I cannot use the Printing Module.

Re: Problem with printing module

Posted: Sat Oct 03, 2009 9:13 am
by Rolf
Hi oliver341

Perhaps you can find some answers here:
http://forum.cmsmadesimple.org/index.ph ... #msg178033

Grtz. Rolf

Re: Problem with printing module

Posted: Sat Oct 03, 2009 2:11 pm
by oliver341
Rolf wrote: Perhaps you can find some answers here:
http://forum.cmsmadesimple.org/index.ph ... #msg178033
Thanks Rolf.

Unfortunately I've hit a dead end. I've uploaded the full package as in point 1, and also confirmed allow_url_fopen is enabled by using PHP phpinfo() as in point 2.

The problem here is that the Printing Module uses a command like this to get its data for inclusion (not real, just an example):
file_get_contents("http://www.myhost.co.uk/index.php?option=print")

The trouble is, this command makes the server connect to itself, and this results in the server rejecting the connection. I have no idea why my webhost behaves like this, but they have said it's for security reasons and they will not change it.

Oh well, at least the Printing Module is the only thing affected!

I suppose the Printing Module could be coded in another way to avoid the server connecting to itself, but the vast majority of users are probably unaffected so there's probably no point in doing it.