LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-20-2012, 08:10 AM   #1
esgol
Member
 
Registered: Jul 2012
Posts: 106
Blog Entries: 1

Rep: Reputation: Disabled
Exclamation Can't run a c++ cgi on Kubuntu 10. Checked all apache configurations.


I'm trying to compile my 1st c++ cgi Programm on kubuntu 10 with Apache2 but nothing.

I've Put it to the cgi-bin folder checked the config files, run the programm on command, changed privileges to executable, but nothing.
Rekonq says 'No service can handle this file'

You can see all configurations and execution in this screenshoot.

http://img832.imageshack.us/img832/1659/cgiv.jpg

I've apt get instal apache2. Have restarted it also. Nuts

Its been all day now and gone desperate. If you have any idea, will save me

Last edited by esgol; 11-20-2012 at 08:38 AM.
 
Old 11-20-2012, 02:22 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
So, you've compiled a 'hello world' program, and want to run it as a CGI? What happens when you run it from the commanline?
The file extension '.cgi' that you've used is technically okay, but is unconventional, and your filesystem browser probably doesn't know how to interpret the meaning of that filename extension. Try renaming the file to something more conventional (and usually, the name of a program reflects the nature of the program's actions, not its source language).

--- rod.
 
Old 11-20-2012, 02:44 PM   #3
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
From the command line it runs ok as you clearly see.

Here is also the code of my configiration file

My cgi-bin is in /usr/lib/cgi-bin
My config file @ etc/apache2/sites-enabled/000-default
I've found elsewhere these were the wright for Kub10-12, and not the /var/www/

PHP Code:
<VirtualHost *:80>
    
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
    
</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>

    
ErrorLog ${APACHE_LOG_DIR}/error.log

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

    CustomLog 
${APACHE_LOG_DIR}/access.log combined

    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

Last edited by esgol; 11-21-2012 at 12:06 PM.
 
Old 11-20-2012, 05:09 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
According to your config file, your server uses "/usr/lib/cgi-bin" for CGI scripts/programs:
Code:
    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>
The alias is the name that browsers will use to request a CGI URL. The <Directory> tag identifies the actual absolute directory name on your server host.

I don't see anything to see that your program runs. You did show a build commandline, but I don't see anything as output from the program. Just to be clear, you do not need to build the program each time it is called as a child by the server.

--- rod.
 
Old 11-21-2012, 01:09 AM   #5
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
It runs what you see to the command line its the output of the programm. As you see its A clear html code.
How couldnt it ruin its from a tutorial site at tutorial point.

So the aphache configuration is all ok?
 
Old 11-21-2012, 10:53 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
No, I think not. You said "My cgi-bin is in etc/apache2/". But the config file says it must be in /usr/lib/cgi-bin.
--- rod.
 
Old 11-21-2012, 12:05 PM   #7
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
No its in /usr/lib/cgi-bin sorry my mistake. But you can see it on the screenshot anyways. (so sorry so sorry :SSSS)
 
Old 11-21-2012, 12:58 PM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
When you request a URL of the form 'http://your.web.server/cgi-bin/cplusplus.cgi' from your HTTP client, what exactly is the result? What shows up in the web server logs?
It would be helpful to use a client like wget to fetch from the server, and post the results here (in [CODE][/CODE] tags so we can read it, please).
Code:
wget -O - http://your.web.server/cgi-bin/cplusplus.cgi
This will print the details to your console, where you can see everything, and copy it here. Also, observe and post the log file entries from the server access log, and the server error log.

--- rod.

Last edited by theNbomr; 11-21-2012 at 01:03 PM.
 
Old 11-22-2012, 02:08 AM   #9
esgol
Member
 
Registered: Jul 2012
Posts: 106

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
OMG i found it i was accesing it through the file system and not at local host though apache wasnt involved. so sorry
 
  


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
How can I run a perl and cgi scripts in my apache.?. ethnicme Programming 6 07-21-2006 04:02 AM
does apache support cgi scripts and how to run them abhis_mail2002 Fedora 3 03-15-2005 04:37 AM
Cant run CGI scripts on Apache! mylo2003 Linux - General 5 11-09-2004 09:22 AM
Apache 2.0.43 will not run cgi scripts RobbieRoy Linux - Networking 5 09-04-2003 02:56 PM
Help CGI won't run under Apache shuttleX Linux - Software 2 06-05-2003 02:37 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:12 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