GD demo cgi script works on command line but not on webserver.

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default GD demo cgi script works on command line but not on webserver.

    Hi all,
    I recently installed GD version 2.34. The installation process went
    well, except that it said, it cannot find -liconv library. It also said
    its harmless.
    I executed the demo script GD-2.34/demo/shapes.pl and it worked
    well.
    Then I executed GD-2.34/demo/gd_example.cgi, where i changed the
    shebang line to the right version of perl and it failed. The error is
    as follows:

    #####################################
    Can't load
    '/apps/yell/perl/sun4/5.8.7/lib/site_perl/5.8.7/sun4-solaris//auto/GD/GD.so'
    for module GD: ld.so.1: /apps/yell/perl/sun4/5.8.7/bin/perl: fatal:
    libjpeg.so.62: open failed: No such file or directory at
    /apps/yell/perl/sun4/5.8.7/lib/5.8.7/sun4-solaris/DynaLoader.pm line
    230.
    at /opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3
    Compilation failed in require at
    /opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3.
    BEGIN failed--compilation aborted at
    /opt/apache/socdb-tii/cgi-bin/gd_example.cgi line 3.
    [Wed Jun 14 14:12:12 2006] [error] [client 172.24.170.192] Premature
    end of script headers: /opt/apache/socdb-tii/cgi-bin/gd_example.cgi
    #####################################

    source file:
    #####################################
    #!/apps/yell/perl/sun4/5.8.7/bin/perl

    use GD;

    print "Content-type: image/png\n\n";

    # create a new image
    $im = new GD::Image(100,100);

    # allocate some colors
    $white = $im->colorAllocate(255,255,255);
    $black = $im->colorAllocate(0,0,0);
    $red = $im->colorAllocate(255,0,0);
    $blue = $im->colorAllocate(0,0,255);

    # make the background transparent and interlaced
    $im->transparent($white);
    $im->interlaced('true');

    # Put a black frame around the picture
    $im->rectangle(0,0,99,99,$black);

    # Draw a blue oval
    $im->arc(50,50,95,75,0,360,$blue);

    # And fill it with red
    $im->fill(50,50,$red);

    binmode STDOUT;

    # Convert the image to PNG and print it on standard output
    print $im->png();

    #########################################


    Running it on the command line works fine. I don't know why it fails
    while apache is executing it.

    -- Peroli Sivaprakasam

    Peroli Guest

  2. Similar Questions and Discussions

    1. #38923 [NEW]: ODBC works through command line but not Apache
      From: matthew dot berry at wolseley dot co dot uk Operating system: Unix PHP version: 5.1.6 PHP Bug Type: ODBC related Bug...
    2. My Script to run a Command-Line from ASP does not work.
      Hi, My Script to run a Command-Line from ASP does not work. No errors are returned either. It is on IIS. The directory where the script exists is...
    3. My Script to run a Command-Line from ASP does not work
      Hi, My Script to run a Command-Line from ASP does not work. No errors are returned either. It is on IIS. The directory where the script exists is...
    4. [PHP] execute command line script from browser
      Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script...
    5. execute command line script from browser
      Is there a way to execute a command line php script from a browser by, say clicking a button and then having the browser let go and let the script...
  3. #2

    Default Re: GD demo cgi script works on command line but not on webserver.

    "Peroli" <peroli@gmail.com> writes:
    > Hi all,
    > I recently installed GD version 2.34. The installation process went
    > well, except that it said, it cannot find -liconv library. It also said
    > its harmless.
    > I executed the demo script GD-2.34/demo/shapes.pl and it worked
    > well.
    > Then I executed GD-2.34/demo/gd_example.cgi, where i changed the
    > shebang line to the right version of perl and it failed. The error is
    > as follows:
    >
    > #####################################
    > Can't load
    > '/apps/yell/perl/sun4/5.8.7/lib/site_perl/5.8.7/sun4-solaris//auto/GD/GD.so'
    > for module GD: ld.so.1: /apps/yell/perl/sun4/5.8.7/bin/perl: fatal:
    > libjpeg.so.62: open failed: No such file or directory at
    > /apps/yell/perl/sun4/5.8.7/lib/5.8.7/sun4-solaris/DynaLoader.pm line
    > 230.
    Is your server configured to run CGI scripts in a chroot "jail"? If so, then
    libjpeg may not be visible from inside the jail, even though it's visible
    from your normal login environment.

    sherm--

    --
    Cocoa programming in Perl: [url]http://camelbones.sourceforge.net[/url]
    Hire me! My resume: [url]http://www.dot-app.org[/url]
    Sherm Pendley Guest

  4. #3

    Default Re: GD demo cgi script works on command line but not on webserver.

    >
    > Is your server configured to run CGI scripts in a chroot "jail"? If so, then
    > libjpeg may not be visible from inside the jail, even though it's visible
    > from your normal login environment.
    >
    > sherm--
    >
    Thanks, sherm. That was the problem. Apache doesn't see this
    directory at all. Problem solved.

    -- Peroli Sivaprakasam

    Peroli Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139