Thread:Extension talk:Collection/Render server error - Collection - mwlib/reply

Hi,

I know this thread is quite old but encountered this problem and none of the suggested fixes worked for me. Just in case anyone else has the same issue still, I thought I'd post my solution.

I'm running a private render server on the same server as our Wiki. CentOS 6.5 x64 MediaWiki 1.22.6 PHP 5.3.3 MySQL 5.1.73 Collection Version 1.6.1

The first step is to ensure SELINUX is disabled. If it was not, the curl_exec($ch) didn't work for me (and I couldn't figure out how to make it work with SELinux).

The second step is to edit $IP/extensions/Collection/Collection.body.php

In the function static function mwServeCommand( $command, $args ) { Replace

$serveURL = $wgCollectionMWServeURL;

with $serveURL = 'myservername:8899/';

For me, this got rid of the "RuntimeError: command failed with returncode 256" error as it seems that, regardless of what is set in LocalSettings.php, $wgCollectionMWServeURL was being set to pediapress. However, I was then left with the "The POST request to server:8899/ failed ($2)" error. I fixed this by replacing $response = Http::post($serveURL, array('postData' => $args));

with

$boundary = '--myboundary-bps'; $retval= ''; foreach($args as $key => $value){ $retval .= "--$boundary\nContent-Disposition: form-data; name=\"$key\"\n\n$value\n"; } $retval .= "--$boundary--"; $body = $retval; $ch = curl_init; curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data; boundary=$boundary")); curl_setopt($ch, CURLOPT_URL, $serveURL); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $body); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); $response = curl_exec($ch);

I got the code from this site and tweaked it http://scraperblog.blogspot.co.uk/2013/07/php-curl-multipart-form-posting.html