in reply to Re^6: Not able to display an image in perl CGI
in thread Not able to display an image in perl CGI

After changing the path also I am getting errors
# perl image1 Content-Type: text/html; charset=ISO-8859-1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-U +S"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +" /> </head> <body> <img src="/cgi-bin/PTF//WP_20140410_19_01_49_Pro.jpg" alt="image" /> </body> </html> #
# cat image1 #!/usr/bin/perl; use strict; use CGI ':standard'; use CGI::Carp 'fatalsToBrowser'; my $file = "/cgi-bin/PTF//WP_20140410_19_01_49_Pro.jpg"; print header, start_html('Test'), img({-src=>$file,-alt=>'image'}), end_html; #
And the error is
[Wed Apr 30 10:29:34 2014] [error] [client 10.142.205.193] (2)No such +file or directory: exec of '/var/www/cgi-bin/PTF/image1' failed [Wed Apr 30 10:29:34 2014] [error] [client 10.142.205.193] Premature e +nd of script headers: image1

The above error is from server logs .. /var/log/httpd/error_log.

Do we have any other logs which can help to resolve this issue

Replies are listed 'Best First'.
Re^8: Not able to display an image in perl CGI
by poj (Abbot) on Apr 30, 2014 at 06:55 UTC
    my mistake - remove the ; on the first line
    #!/usr/bin/perl
    poj
      Now I can see that I not getting any error in Explorer, but the image is not displayed. ( One small icon has been displayed after executing the script )

      In erro_log

      [Wed Apr 30 12:27:07 2014] [error] [client 10.142.205.193] (8)Exec for +mat error: exec of '/var/www/cgi-bin/PTF/WP_20140410_19_01_49_Pro.jpg +' failed, referer: http://10.58.117.54/cgi-bin/PTF/image1 [Wed Apr 30 12:27:07 2014] [error] [client 10.142.205.193] Premature e +nd of script headers: WP_20140410_19_01_49_Pro.jpg, referer: http://1 +0.58.117.54/cgi-bin/PTF/image1
        Try with some other jpg files that you know are good.
        poj