PDA

View Full Version : enabling apache in bootable knoppix



vinlouis
09-26-2005, 03:51 AM
Hi all,

Would like to ask how do i enable apache+cgi+perl using the live CD , like to run some perl n cgi scripting without installing yet
tried to do a chkconfig --list httpd , unfortunally don't think knoppix had that install.

appreciate if anyone could enlighten me on this

Thanks a million,
vinlouis

markpreston
09-26-2005, 07:28 PM
You need to be root to do this.
You can do it graphically by running these commands from a terminal window as user knoppix
su root <enter>
then, at the root prompt
konqueror<enter>
Then you can browse the filesystem and write/copy files to the /var/www directory from within konqueror.

I find writing php code in a text editor works for me.
At the root prompt type
nedit followed by [enter]
Then, as previously suggested write
Code:


<?php phpinfo(); ?>


and save the file in the /var/www directory as suggested by MaxIT.
Then visit the file with a browser as he also suggests.
Once this works you can then test out perl and bash scripts.
Use whatever text editor you prefer out of those available (nedit, kate, kwrite, emacs and vim).
Create a file as root with the following.
Code:


#!/bin/bash

printf "Content-type:text/html\r\n\r\n";
printf "<html>hello world</html>\r\n";


This bash script should be saved as hello.cgi and saved in the /usr/lib/cgi-bin directory.
It also needs to be made executable for all users:
At a root prompt type
chmod 755 /usr/lib/cgi-bin/hello.cgi
Then visit the file with a browser e.g. mozilla
http://127.0.0.1/cgi-bin/hello.cgi

Once this works you can do the same for perl. This time saving the file as hello.pl
and using the following code:
Code:


#!/usr/bin/perl

print "Content-type:text/html\n\n";
print "<html>hello world</html>\n";


Once you have got these three programs going then you have a wide choice to start open source web programming under Knoppix Debian/Gnu/Linux.


References
http://www.knoppix.net/forum/viewtopic.php?t=19300&highlight=

http://www.knoppix.net/forum/viewtopic.php?t=18105&highlight=

vinlouis
09-29-2005, 02:41 AM
thanks dude ;)