LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Can't run a c++ cgi on Kubuntu 10. Checked all apache configurations. (https://www.linuxquestions.org/questions/programming-9/cant-run-a-c-cgi-on-kubuntu-10-checked-all-apache-configurations-4175437953/)

esgol 11-20-2012 08:10 AM

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

theNbomr 11-20-2012 02:22 PM

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.

esgol 11-20-2012 02:44 PM

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


theNbomr 11-20-2012 05:09 PM

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.

esgol 11-21-2012 01:09 AM

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?

theNbomr 11-21-2012 10:53 AM

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.

esgol 11-21-2012 12:05 PM

No its in /usr/lib/cgi-bin sorry my mistake. But you can see it on the screenshot anyways. (so sorry so sorry :SSSS)

theNbomr 11-21-2012 12:58 PM

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.

esgol 11-22-2012 02:08 AM

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


All times are GMT -5. The time now is 11:48 PM.