Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-13-2009, 10:05 AM   PM User | #1
resander
New to the CF scene

 
Join Date: Aug 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
resander is an unknown quantity at this point
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?
resander is offline   Reply With Quote
Old 06-13-2009, 12:54 PM   PM User | #2
A1ien51
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
A1ien51 will become famous soon enough
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]
A1ien51 is offline   Reply With Quote
Old 03-18-2011, 03:01 PM   PM User | #3
Neil_in_Chicago
New to the CF scene

 
Join Date: Mar 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Neil_in_Chicago is an unknown quantity at this point
I'm having problem #2, exactly. (And it's difficult to Google for!)
Any resolution, hints, clues or links?
What finally happened?
Neil_in_Chicago is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:26 PM.


Advertisement
Log in to turn off these ads.