From owner-freebsd-questions@FreeBSD.ORG Mon May 7 20:26:08 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B2E7716A402 for ; Mon, 7 May 2007 20:26:08 +0000 (UTC) (envelope-from parv@pair.com) Received: from mta16.adelphia.net (mta16.adelphia.net [68.168.78.211]) by mx1.freebsd.org (Postfix) with ESMTP id 4479113C457 for ; Mon, 7 May 2007 20:26:08 +0000 (UTC) (envelope-from parv@pair.com) Received: from default.chvlva.adelphia.net ([24.126.17.68]) by mta16.adelphia.net (InterMail vM.6.01.05.04 201-2131-123-105-20051025) with ESMTP id <20070507202607.HUSA26916.mta16.adelphia.net@default.chvlva.adelphia.net>; Mon, 7 May 2007 16:26:07 -0400 Received: by default.chvlva.adelphia.net (Postfix, from userid 1000) id 99B71BAD8; Mon, 7 May 2007 16:26:36 -0400 (EDT) Date: Mon, 7 May 2007 16:26:36 -0400 From: Parv To: White Hat Message-ID: <20070507202636.GA1922@holestein.holy.cow> Mail-Followup-To: White Hat , FreeBSD Users Questions References: <19743.80650.qm@web34410.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19743.80650.qm@web34410.mail.mud.yahoo.com> Cc: FreeBSD Users Questions Subject: Re: OT - Perl Script in Apache X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: f-q List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2007 20:26:08 -0000 in message <19743.80650.qm@web34410.mail.mud.yahoo.com>, wrote White Hat thusly... > > Running Apache on a FreeBSD-6.2 machine, I am attempting to set up > a web page that changes a specific image on a daily basis. I found > a Perl script that is supposed to do this, but it seems to fail. > All that is displayed is a red [X]. If I run the script from the > command line, it works, as it should. Well, at least it displays > the correct file name. ... > To display an image simply use this in your HTML: > ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ Note that here, value for "src" attribute, the file location which can be accessed through the web server is needed. If the Perl program spits that out, great. The program posted puts out additional junk as is. When you look at the source of the generated page where you use img tag, what do you actually see? You may need to employ SSI ... http://httpd.apache.org/docs/2.2/howto/ssi.html ... as in ... "> Do not forget to mark perl_script.pl executable. > #!/usr/local/bin/perl > > # find out the day of the year > my $day_of_year = (localtime(time()))[7]; > > # define the path where the images live "." is the > current directory Please either carefully reformat the program or post the original as is. As you had posted, this program will not even compile as the comments are not properly wrapped. ... > print "Location: $files[$image_to_use]\n\n"; Does the image appear if you change the print argument to just the file name, as in ... print $files[$image_to_use]; (... for there is no need to generate a HTTP header (which could be considered erroneous) for your usage for the header has been already sent as part of the page presented containing the img tag)? - Parv --