UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
397 Views
Registered: ‎07-17-2018

Petalinux 2017.4 busybox httpd cgi 404 not found

Jump to solution

Hi, all.

I can't display my cgi file.

I can display my htm file.

What is wrong settings?

 

I put "test.cgi" to /srv/www/cgi-bin/.

And Access to this file on browser.

URL is http://192.168.1.162/cgi-bin/test.cgi(192.168.1.162 is my zc706 board IP address).

 But Browser display "404 Not Found".

"test.cgi" is below.

----

#!/bin/bash
echo "a"

----

 

httpd exec with option -h /srv/www.

When ps command exec, output is below.

 /usr/sbin/httpd -h /srv/www

 

/etc/httpd.conf didn't create.

 

Thank you.

0 Kudos
1 Solution

Accepted Solutions
Scholar rfs613
Scholar
359 Views
Registered: ‎05-28-2013

Re: Petalinux 2017.4 busybox httpd cgi 404 not found

Jump to solution

There are several potential problems:

  1. There is no "bash", just the busybox shell.
  2. Script needs to output HTTP headers before the data.
  3. Script must be executable.

So give the following a try. Note the shell is "sh" rather than bash. Also, headers are being output, followed by a blank line, and then your data.

 

#!/bin/sh
echo -en "Content-type: text/html\r\n"
echo -en "\r\n"
echo "a"

Make sure your script is executable, and try running it as "/srv/www/cgi-bin/test.cgi"... make sure you see the output appearing. Then give it a try from your browser and you should see "a" appear.

View solution in original post

2 Replies
Scholar rfs613
Scholar
360 Views
Registered: ‎05-28-2013

Re: Petalinux 2017.4 busybox httpd cgi 404 not found

Jump to solution

There are several potential problems:

  1. There is no "bash", just the busybox shell.
  2. Script needs to output HTTP headers before the data.
  3. Script must be executable.

So give the following a try. Note the shell is "sh" rather than bash. Also, headers are being output, followed by a blank line, and then your data.

 

#!/bin/sh
echo -en "Content-type: text/html\r\n"
echo -en "\r\n"
echo "a"

Make sure your script is executable, and try running it as "/srv/www/cgi-bin/test.cgi"... make sure you see the output appearing. Then give it a try from your browser and you should see "a" appear.

View solution in original post

Adventurer
Adventurer
341 Views
Registered: ‎07-17-2018

Re: Petalinux 2017.4 busybox httpd cgi 404 not found

Jump to solution

First, My cgi file has ^M code.

I erase '\r' to use below command.

$ sed -i 's/\r//' test.cgi

 

Second, Script needs to output HTTP headers before the data.

I add Scholar's code.

 

After two change,I can see "a" appear.

Thank you very much!

 

0 Kudos