Loading ...
Sorry, an error occurred while loading the content.

Need help - No such file or directory: exec of '/opt/lampp/cgi-bin/lights.cgi'

Expand Messages
  • erabelas
    I have a server and client scripts called lights.pl and lights.cgi. This script controls my X10 lamps using the Device and ControlX10 perl modules. I can t run
    Message 1 of 2 , Jul 13, 2008
    • 0 Attachment
      I have a server and client scripts called lights.pl and lights.cgi.
      This script controls my X10 lamps using the Device and ControlX10 perl
      modules. I can't run this successfully on my Ubuntu with the latest
      SOAP-Lite-0.710.07 version as well as the version 0.69 which is the
      available version in Ubuntu. But it runs in Windows with SOAP-Lite
      version 0.55-r1.

      The error is always like this, I copied it from the error.log from apahce.

      [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] (2)No such
      file or directory: exec of '/opt/lampp/cgi-bin/lights.cgi' failed
      [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] Premature end
      of script headers: lights.cgi
      [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] [Sun Jul 13
      22:00:23 2008] lights.pl: 500 Internal Server Error at
      /opt/lampp/cgi-bin/lights.pl line 13

      lights.pl script is like this,

      #!/usr/bin/perl -w
      use CGI::Carp qw(fatalsToBrowser);
      use SOAP::Lite;
      use CGI ':standard';

      #Turn on Lights
      $unit = param('unit');
      $onoff = param('onoff');

      &turn_lights_soap($unit,$onoff);

      sub turn_lights_soap {
      $soap_response = SOAP::Lite ## this is line 13
      -> uri('http://192.168.0.75/Lights')
      -> proxy('http://192.168.0.75/cgi-bin/lights.cgi')
      -> turn_lights ($unit,$onoff);


      my $res = $soap_response->result;
      print "Content-type: text/html\n\n";
      print "$res\n";

      }
      lights.cgi is like this,

      #!usr/bin/perl -w

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Lights')
      -> handle;

      package Lights;

      sub turn_lights {

      use Device::SerialPort;
      use ControlX10::CM11;

      my ($class, $unit, $onoff) = @_;

      my $HOUSE_CODE = "A";

      my %UNIT_CODE = (
      "living_lamp" => "1",
      "bed_lamp" => "2",
      "study_lamp" => "3",
      "fan" => "4",
      );

      my %cmds = (
      "on" => "J",
      "off" => "K",
      );

      my $serial = Device::SerialPort->new('/dev/ttys0', undef );
      # $serial->error_msg(1); # use built-in error messages
      $serial->user_msg(0);
      $serial->databits(8);
      $serial->baudrate(4800);
      $serial->parity("none");
      $serial->stopbits(1);
      $serial->dtr_active(1);
      $serial->handshake("none");
      # $serial->write_settings || die "Could not set up port\n";

      # Adress unit
      ControlX10::CM11::send( $serial, $HOUSE_CODE . $UNIT_CODE{$unit} );
      # Send command
      ControlX10::CM11::send( $serial, $HOUSE_CODE . $cmds{$onoff} );

      return "$unit $onoff";

      }

      EVEN the sample hibye.cgi and hibye.pl scripts, it will not run, the
      error is,
      [Sun Jul 13 21:57:11 2008] [error] [client 192.168.0.75] Premature end
      of script headers: hibye.pl

      Any help is greatly appreciated,

      Edward
    • rahed
      ... It can be anything of: permissions of lights scripts and cgi-bin directory, owner should be apache user scripts line endings on unix: line feed, on windows
      Message 2 of 2 , Jul 14, 2008
      • 0 Attachment
        > The error is always like this, I copied it from the error.log from apahce.
        >
        > [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] (2)No such
        > file or directory: exec of '/opt/lampp/cgi-bin/lights.cgi' failed
        > [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] Premature end
        > of script headers: lights.cgi
        > [Sun Jul 13 22:00:23 2008] [error] [client 192.168.0.75] [Sun Jul 13
        > 22:00:23 2008] lights.pl: 500 Internal Server Error at
        > /opt/lampp/cgi-bin/lights.pl line 13

        It can be anything of:

        permissions of lights scripts and cgi-bin directory, owner should be apache user

        scripts line endings on unix: line feed, on windows line feed & carriage return

        last line of the package should be: 1;

        and possible other causes

        hth


        --
        Radek
      Your message has been successfully submitted and would be delivered to recipients shortly.