Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Apache fetches executable instead of executing it or Security Error

    For Ubuntu 8.10, Apache 2.x, Firefox 3.0, Opera 9.6

    I have a basketful of applications written in C/C++ that I would want to web-enable, i.e. make accessible from the web. All use MySQL via ODBC (in C/C++) and output to local OS GUIs. I will put the backend database stuff on an Apache server and do the GUI in a browser. The two will communicate via AJAX and JSON.

    The backend cannot be recoded in PHP or PERL. It is too big. There is a fair amount of work needed to generate JSON data, so it would be impractical and take too long to upload to an external server, so I want to use the Apache server on my PC.

    I have never used Apache with AJAX before and got into problems right away after issuing XMLHttpRequestObject.open("GET", url );

    The test html file toajax.html is in /home/ken/projects/ajax directory and so is the executable cgi test program ajax.cgi written in C:

    Code:
    int main ( int argc , char * argv[] )
       {
       printf ("Content-Type: text/plain; charset=us-ascii\n\nAJAX - Hello\n" ) ;
       return 0 ;
       }


    Content of /etc/apache2/httpd.conf:

    Code:
    ScriptAlias /cgi-bin/ /home/ken/projects/ajax
    AddHandler cgi-script .cgi
    
    <Directory "/home/ken/projects/ajax">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
         Allow from all
        AddHandler cgi-script .cgi
    </Directory>



    1. Security error

    Firefox Error console returns

    When url="/cgi-bin/ajax.cgi" OR "file:///cgi-bin/ajax.cgi"

    Security Error: Content at file:///home/ken/projects/ajax/toajax.html may not load data from file:///cgi-bin/ajax.cgi.

    When url= "http:///cgi-bin/ajax.cgi"

    Security Error: Content at file:///home/ken/projects/ajax/toajax.html may not load data from http://cgi-bin/ajax.cgi.

    I expected the ScriptAlias directive to expand /cgi-bin/ in the url to filepath:

    file:///home/ken/projects/ajax/ajax.cgi



    2. fetches executable content instead of executing it

    When url="ajax.cgi"

    The callback is executed, but the the data is the content of ajax.cgi

    I expected the <directory> directive in /etc/apache2/httpd.conf to execute ajax.cgi.


    So, not much joy so far.

    What do I need to do to execute ajax.cgi on my local apache?

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    It has nothing to do with Ajax, before going all Ajax wild try typing the url in the browser and get it running that way.

    Sounds like you have not set up Apache to run cgis: http://www.chrisranjana.com/apache-d...howto/cgi.html

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New to the CF scene
    Join Date
    Mar 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm having problem #2, exactly. (And it's difficult to Google for!)
    Any resolution, hints, clues or links?
    What finally happened?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •