Ubuntu, LAMP, Cgi setup, HELP :(

Chronictank

FH is my second home
Joined
Jan 21, 2004
Messages
10,133
I Am at my wits end after struggling to get this working all week.
I basically want the ability to run perl scripts which use CGI.
I am a complete linux noob in terms of setting things up so bear with me.

The kernel is 2.6.15-51, and the version of Ubuntu is "Ubuntu-Server 6.06.2"

ok, so here is my script

Code:
#!/usr/local/bin/perl

print "Content-type: text/html\n\n";
use CGI::Carp qw(fatalsToBrowser);


print "<HTML><HEAD><TITLE>Hello, world!</TITLE></HEAD>";
print "<BODY><H1>Hello, world!</H1></BODY></HTML>";
using perl test.pl it works fine, the output is as expected.

The error log says:
Code:
[Thu Apr 10 18:42:13 2008] [error] [client 192.168.1.2] (2)No such file or directory: exec of '/usr/lib/cgi-bin/test.pl' failed

[Thu Apr 10 18:42:13 2008] [error] [client 192.168.1.2] Premature end of script headers: test.pl

Now this lead me to think it was the permissions, but both the file and the cgi-bin directory is set to chmod 755

I have xserver and webmin installed but couldnt work out how to configure cgi-bin so have just been doing it manually.
Here is my site file:
Code:
NameVirtualHost *
<VirtualHost *>
	ServerAdmin webmaster@localhost
	
DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride None
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride None
		Order allow,deny
		allow from all
		# Uncomment this directive is you want to see apache2's
		# default start page (in /apache2-default) when you go to /
		#RedirectMatch ^/$ /apache2-default/
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride None
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

    ScriptAlias /cgi/bin /var/www/cgi-bin/
    <Directory /var/www/cgi-bin>
	Options ExecCGI
	AddHandler cgi-script cgi pl
    </Directory>
	
	ErrorLog /var/log/apache2/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog /var/log/apache2/access.log combined
ServerSignature On

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

Now ultimately i want the scripts to run from /var/www/cgi-bin because thats where all my website files are (index.html works from the /var/www directory)

Any help would be MUCH appreciated:mad:
 

Chronictank

FH is my second home
Joined
Jan 21, 2004
Messages
10,133
lol nr mind just spotted the problem looking at my post ><
sigh wasted 3 hrs !
 

Users who are viewing this thread

Top Bottom