LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-23-2005, 09:55 PM   #1
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Rep: Reputation: 30
Perl (WebFTP) and Apache2...


I want to get WebFTP running on my Apache2 server but when I go to access the *.cgi script which is written is perl it only comes up as test, like I was opening a *.txt file. I am guessing that there is an Apache module that I need to include in my httpd.conf but I am more likely wrong. What is it that is keeping me from running this file? Thanks

Note: I do have perl installed and in the WebFTP.conf file, it asks where my perl binary is and I double check that the location is valid and that I have perl installed.

Last edited by darkarcon2015; 01-24-2005 at 08:33 AM.
 
Old 01-24-2005, 10:43 PM   #2
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Any help, please?
 
Old 01-25-2005, 12:22 AM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
You will need to include mod_cgi. You will also need to set either ScriptAlias or use AddHandler to set the file extensions of any cgi scripts you'll be using. This is all covered in great detail in the Apache manual:

http://httpd.apache.org/docs-2.0/mod/mod_cgi.html
http://httpd.apache.org/docs-2.0/howto/cgi.html

You may also want to check out mod_perl, although it isn't required:
http://perl.apache.org/index.html
 
Old 01-25-2005, 10:29 AM   #4
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Okay I made sure everything is correct but whenever I try to access my *.cgi file it says that it is Forbidden. I made the cgi-bin folder and the folder that Web-FTP is in all Read-Write enabled and still a forbidden message.
 
Old 01-25-2005, 12:27 PM   #5
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Did you setup ScriptAlias, as well as allow access to the cgi-bin directory in the httpd.conf? Here's an example:

Code:
ScriptAlias /cgi-bin/ "/usr/local/apache2/cgi-bin/"

<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
 
Old 01-25-2005, 07:35 PM   #6
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Yes that is all there and uncommented.
 
Old 01-25-2005, 08:57 PM   #7
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Ok, what is the complete path to your document root? What is the complete path to your server root? And what is the complete path to the cgi-bin directory? What are the permissions on the directory and who owns them, ie "ls -l". You could also post your httpd.conf file if you want.

The cgi-bin directory is usually setup relative to the server root, not the document root. In other words it would go in the same directory where the "conf" directory resides (usually apache2), not within the directory where the website's html pages are. Of course that's not written in stone, it's just how things are usually done by default and what the above ScriptAlias assumes.

Last edited by DaHammer; 01-25-2005 at 08:58 PM.
 
Old 01-25-2005, 10:29 PM   #8
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
Okay here is the info:

Server Root: /etc/apache2 / rw-r--r-- / root.root
Document Root: /var/www/htdocs / rwxrwxrwx / ryan.users
cgi-bin Directory: /var/www/cgi-bin / rwxrwxrwx / root.root
 
Old 01-25-2005, 11:02 PM   #9
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Do you have mod_alias loaded? It is required for scriptalias to work and I bet your cgi-bin directory access is setup to only load if that module is loaded, ie within a <IfModule mod_alias.c> </IfModule>. The permissions should be this on the cgi-bin directory:
Code:
drwxr-xr-x  2 root  root  4096 Oct 31 15:00 cgi-bin/
Post the ScriptAlias line as well as the Directory setup for the cgi-bin directory.
 
Old 01-26-2005, 08:17 AM   #10
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
My mod_alias is loaded by this line:

Code:
LoadModule alias_module lib/apache2/mod_alias.so
Then my ScriptAlias and Direcory set up is just this:

Code:
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
    AllowOverride None
    Options None
    Order allow,deny
    Allow from all
</Directory>
So I should make the ScriptAlias line look like this:

Code:
<IfModule mod_alias.c>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
 
Old 01-26-2005, 01:11 PM   #11
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
What are the permissions on the file you're trying to run? Have you tried multiple cgi scripts?
 
Old 01-26-2005, 02:38 PM   #12
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
I have full permissions on the cgi that I am trying to run. Also, should I make that line look like this?

Code:
<IfModule mod_alias.c>
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
EDIT: That didn't make a difference.

Last edited by darkarcon2015; 01-26-2005 at 02:40 PM.
 
Old 01-26-2005, 03:10 PM   #13
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
At this point I'm not even sure you can access files within the cgi-bin directory. What is the exact error you recieve? Try commenting out the ScriptAlias directive, place this under it:

Alias /cgi-bin/ "/var/www/cgi-bin/"

then do this:

echo testing > /var/www/cgi-bin/test.txt

restart apache and see if you can access http://yoursite/cgi-bin/test.txt

If you can't, then something is wrong with the permissions or something in your httpd.conf.

Then uncomment the ScriptAlias directive, remove/comment the Alias directive added above, restart apache, and run this command:
Code:
cat > /var/www/cgi-bin/test.cgi << "EOF"
#!/bin/sh

echo Content-type: text/plain
echo

echo "Hello"
EOF
This will place a simple cgi script in the cgi-bin directory. Make it executable:
Code:
chmod a+x /var/www/cgi-bin/test.cgi
Then see if you can run it. Also look at your Apache logs.
 
Old 01-26-2005, 03:23 PM   #14
darkarcon2015
Member
 
Registered: Jun 2004
Location: Potsdam, NY
Distribution: Fedora Core 6
Posts: 201

Original Poster
Rep: Reputation: 30
I did the first part and when I accessed test.txt I saw the word "testing" like I should have. Then I did the next thing and when I ran the test.cgi I saw the word "Hello" like I should have. So is this a problem with Web-FTP?

EDIT: Okay, now when I access the web-ftpc.cgi file I get an Internal Server Error.
EDIT2: I can now access the web-ftp.cgi but when I enter my boxes account info it doesnt go anywhere (i.e. username and password).

Last edited by darkarcon2015; 01-26-2005 at 03:30 PM.
 
Old 01-26-2005, 11:14 PM   #15
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Yeah, that's something with webftp vs Apache and cgi.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cant get perl working with apache2 Garda Linux - Networking 1 09-28-2005 10:27 PM
Need help compiling mod perl with apache2 unixmad Linux - Software 0 08-25-2004 06:34 AM
how do i install mod perl with apache2 unixmad Linux - Newbie 2 08-22-2004 12:00 PM
Perl error after upgrade apache -> apache2 FloFri Debian 6 05-25-2004 04:36 AM
Apache2 + php + perl + ssl + FPSE2k joshf Linux - Newbie 1 07-09-2003 10:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration