LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-22-2004, 01:03 AM   #1
leduytien
Member
 
Registered: Oct 2004
Posts: 39

Rep: Reputation: 15
please help me with Apache Server ...


(I'm learning Linux ^_^ - sorry if the question is stupid ^_^)

Ok, I'm installed Fedora Core 3 with all packages in the Server section. I want to be able to test Perl site (cgi), PHP in localhost (all these packages were installed).

I already start following services:

+ postgresql (don't know if it's neccessary, but it seems so for database related activities)
+ httpd (Apache Server)
+ mysqld (MySQL server)

I copied a cgi script to the folder "/var/www/html" as the instruction of Apache and try to run it (http://localhost/script.cgi), the script didn't run - although the browser display the content which also includes script codes as below (part of the page) (I ensure that the script is correct - because I ran it succesfully on IIS server on Windows):

################################
Checking for %s Modules:
\n\t
\n", $req ? "Required" : $data ? "Data Storage" : "Optional"; if (!$req && !$data) { print <

The following modules are optional; If your server does not have these modules installed, you only need to install them if you require the functionality that the module provides.
MSG } if ($data) { print <

The following modules are used by the different data storage options in Movable Type. In order run the system, your server needs to have at least one of these modules installed.
MSG } my $got_one_data = 0; for my $ref (@$list) { my($mod, $ver, $req, $desc) = @$ref; print "
################################

Did I need to do any configuration to Apache server in order to run cgi and php scripts (I haven't done anything - just installed and run it) ? or do I need to install any additional modules?

Last edited by leduytien; 10-22-2004 at 01:05 AM.
 
Old 10-22-2004, 03:10 AM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
You have to instruct apache to run those scripts.
Generally there is something like
Code:
     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options ExecCGI 
                Order allow,deny
                Allow from all
        </Directory>
in the config-file that says http://yourhost/cgi-bin/ is an alias to the directory
/usr/lib/cgi-bin and that directory has a flag (among others) "ExecCGI".


Postgresql and mysql are both doing the same thing -- offering a database. They are just different products.
 
Old 10-22-2004, 03:16 AM   #3
wimdh
LQ Newbie
 
Registered: Aug 2004
Location: Dendermonde, Belgium
Distribution: Ubuntu latest
Posts: 28

Rep: Reputation: 15
CGI scripts live in the cgi directory. I think for Fedora it's /var/www/cgi-bin
Put your CGI in that directory (check the permissions) and try again.
PHP scripts can live in the HTML directory (/var/www/html), but check if the PHP module for apache is installed.
You can find it in httpd.conf (try 'locate httpd.conf' as root to find the file).

PostgreSQL is a database server. It has nothing to do with Apache, but you can use it to store usernames/passwords for authentication.
MySQL is also a database server, installing both servers is useless (unless you want to learn PostgreSQL and MySQL)...

Hope this helps!

Cheers!
Wim
 
Old 10-22-2004, 08:38 AM   #4
leduytien
Member
 
Registered: Oct 2004
Posts: 39

Original Poster
Rep: Reputation: 15
That's helpful (I really learned a lots from this forum ^_^).

One more question: as usually see in some hosting service, they permit to run cgi script in whatever directory (I mean, you don't have to store them in a special directory like cgi-bin). Although this might be insecure, in my case, I just want to test locally => it's more convenient. How can I do that?
 
Old 10-22-2004, 10:21 AM   #5
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Put the "ExecCGI" to the options of your www-root directory. That way, every directory works the same way as the dedicated cgi directory.
 
Old 10-22-2004, 05:01 PM   #6
leduytien
Member
 
Registered: Oct 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Oop, it still doesn't work. I tried both way:

+ Copy script.cgi to the www/cgi-bin directory
+ add ExecCGI option for www/html directory (in httpd.conf file)

Still got the same output as the first post (scripts doesn't run and , the browser display the source code)

I remember in Windows, for example, in order to run CGI scripts using IIS, I have to set a handler for file with extension *.cgi. Do I have to do that kind of thing in Apache? and If yes, how?
 
Old 10-22-2004, 06:09 PM   #7
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Do you have the cgi.load included (eg. line
Code:
LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so
in the confs).

And probably something like
Code:
AddHandler cgi-script .cgi
has to be done too.

and the files should have execute permission (+x flag).
 
Old 10-25-2004, 02:23 AM   #8
wimdh
LQ Newbie
 
Registered: Aug 2004
Location: Dendermonde, Belgium
Distribution: Ubuntu latest
Posts: 28

Rep: Reputation: 15
You can try checking your file attributes, if the module is loaded...

If you want to know what's going on, you can check the messages Apache produces in
/var/log/httpd/access.log and /var/log/httpd/error.log
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
setting up a slack, apache server with php and a sql server. caged Slackware 1 10-25-2004 04:45 AM
problems setting up apache and vsftp server behind a router that serves as a server xone Linux - Security 1 04-08-2004 10:46 AM
Setup linux-apache server to access documents on NT server josephswagner Linux - Software 11 04-11-2003 08:35 AM
Apache Server Config, Mail Server, & Uploading johan the olive Linux - Networking 5 03-14-2003 11:42 PM
Apache server and MySQL server won't run at startup! dday007 Linux - General 2 02-07-2003 02:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:27 PM.

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