Project

General

Profile

Actions

Bug #2821

closed

Porting lighttpd to new OS

Added by tamarnator over 6 years ago. Updated over 6 years ago.

Status:
Invalid
Priority:
Normal
Category:
mod_fastcgi
Target version:
-
ASK QUESTIONS IN Forums:

Description

I have been assigned to port code written several years ago, by an external contractor, to another OS. The original OS was ElinOS, version 2.6.34.12, a Linux based OS, on an embedded system. We are building the same 2.6.34.12 in a buildRoot environment, so everything is being rebuilt from scratch. Things have been going along pretty nicely, but I think I bumped into an issue with lighttpd, and was hoping for some suggestions.

The code I am having an issue with has been working in the ElinOS environment, but fails in the buildRoot environment. I'm sure there is some library, package or permission issue, but have not nailed it down yet.

The code in question is written in PHP, and is sending JSON encoded requests using Curl.

function list_connections()
        $data = array(
        'service' => 'org.freedesktop.NetworkManagerSystemSettings|/org/freedesktop/NetworkManagerSettings',
        'method' => 'org.freedesktop.NetworkManagerSettings.ListConnections',
        'id' => 0,
        'params' => array()
        );

        $json_data =json_encode($data);
        $result = curl_post("http://localhost/rpc", $json_dta);
        $result2 = json_decode($result);
        return $result2->result;
}

Here is the implementation of the curl_post() function:

function curl_post($url, $post = NULL, array $options = array())
{
        $defaults = array(
                CURLOPT_POST => 1,
                CURLOPT_HEADER => 0,
                CURLOPT_URL => $url,
                CURLOPT_FRESH_CONNECT => 1,
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_FORBID_REUSE => 1,
                CURLOPT_TIMEOUT => 4,
                CURLOPT_POSTFIELDS => $post
        );

        $ch = curl_init();
        curl_setopt_array($ch, ($options + $defaults));
        curl_setopt($ch, CURLOPT_HTTPHEADER, array("Expect:"));

        if ( ! $result = curl_exec($ch))
        {
                trigger_error(curl_error($ch));
        }
        curl_close($ch);
        return $result;
}

I believe I have narrowed the issue down to the setup of the mod_fastcgi module in lighttpd.conf. Here is the code:


fastcgi.server = (
        "/rpc" => ((
                "bin-path" => "/usr/bin/json-dbus-bridge",
                "socket" => "/tmp/json-dbus-bridge.socket",
                "check-local" => "disable",
                "mode" => "responder",
                "max-procs" => 1,
        )),
)

The issue seems to be that the prefix /rpc is not being recognized in the buildRoot environment. Works like a champ in the ElinOS environment. The version of lighttpd that is being built is 1.4.30.

The issue is that all requests that are sent to http://localhost/rpc are encountering the following error:

HTTP/1.1 500 Internal Server Error

My suspicion is that all requests sent to the /rpc prefix in the buildRoot environment are not being handled correctly. I'm wondering if lighttpd needs to be built with any particular options, if some directory or file permissions are incorrect, or if there are dependencies on other libraries or packages that I have not discovered yet.

For instance, I found a package in PHP called xmlrpc, that looked promising, but it does not appear that it was ever part of the ElinOS build. This is all new to me. Many of the web pages are being correctly served by lighttpd. Only JSON encoded messages, being sent by Curl, are having issues. I have been working like an archeologist, trying to discover all of the bones in this old fossil, but something is still missing. Any pointers on prerequisites, or build options, would be much appreciated!

Actions #1

Updated by tamarnator over 6 years ago

I unintentionally entered this as a bug. This is my first time to enter an issue, and I missed that field, and it looks like "Bug" was the default. I don't know how to edit that field. If there is an admin monitoring, please feel free to reclassify.

Actions #2

Updated by tamarnator over 6 years ago

Here are some error messages I managed to capture, which seem to be related:

mod_fastcgi.c:1732 connect failed: Connection refused on unix:/tmp/json-dbus-bridge.socket.0
mod_fastcgi.c:3025 backend died: we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
mod_fastcgi.c:1103 the fastcgi-backend /usr/bin/json-dbus-bridge failed to start
mod_fastcgi.c: 1107 child existed with status 22 /usr/bin/json-dbus-bridge
mod_fastcgi.c 1110 if you're trying to run yhour app as a FastCGI backend, make sure if this is PHP on Gentoo, add fastcgi to the USE flags
mod_fastcgi.c:2842 ERROR: spawning fcgi failed

When I enter the 'ps' command, I can see that json-dbus-bridge is running, so I'm curious why the error messages would claim that it failed to start.

Actions #3

Updated by gstrauss over 6 years ago

  • Status changed from New to Invalid
  • Target version deleted (1.4.x)

Sorry, this is neither a bug nor a feature request. Please see the "Support" forum for questions like this.

First, please test with the latest version of lighttpd, which is lighttpd 1.4.45. lighttpd 1.4.30 is positively ancient, released over 5 1/2 years ago in Dec 2011.

Actions

Also available in: Atom