CGI not working

I have just built a web app in the IDE and want to deploy it. Before doing so I double clicked on the app.cgi and expected it to be launched by Safari, but instead I get a message box with the following text;
You are opening the application “IE Crash Detection — Windows XP.app” for the first time. Are you sure you want to open this application?
And before you ask, the app is creatively called ‘Test’. The build settings in the IDE are set for OSX. What is confusing for me is that I thought CGI documents were cross platform or cross browser. Any clues?

If you make a cgi you need to deploy it through a webserver (apache, iis, …)
Otherwise you need to compile a standalone webapp instead of a cgi one. Those you can run and then use your browser to connect to the standalone.

Can you do that with preferences or do you need to use a pragma?

Build settings(Bottom of the Navigator) > Shared > Deployment Type
When you have the app open, you access it in your browser on http://127.0.0.1:the_port_you_chose

I am not sure what you mean Albin, how do I open the web app if not in a browser?
Does not compute!!

CGI’s can be cross platform. You don’t run them directly, they are executed by a web server.

I believe Albin was referring to a standalone web app. You have to launch it yourself, and then you can access it in your browser. A CGI app is launched for you be the web server. A standalone app IS a web server.

That’s exactly what I meant :slight_smile:

Sorry guys for the lack of understanding. Does this mean that I can test the app online by dropping the CGI file onto a sub-directory in my domain and launch it via a URL i.e.: www.mydomain.com/app/test

If not then I am really missing something.

Not really.
It depends on the settings of your server.
On shared hosting it might be as simple as uploading to a cgi-bin folder on your server (ask your provider if you are not sure)
A VPS is a much better choice for deploying though, but then you are in charge of setting things up yourself.
For Apache you can find some documentation here.
http://httpd.apache.org/docs/2.2/howto/cgi.html
For IIS 6.0
https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/6d1bbdf7-1834-4ccd-862d-e4dc7587f314.mspx
For IIS 7.0
https://forum.xojo.com/8396-deployment-to-iis/0
http://community.microfocus.com/microfocus/cobol/net_express__server_express/w/knowledge_base/23805.deploying-cgi-web-application-on-iis-7.aspx
For lighttpd
http://redmine.lighttpd.net/projects/1/wiki/docs_modcgi
for Nginx
http://wiki.nginx.org/SimpleCGI
or
https://forum.xojo.com/4149-load-balancing-with-nginx

General info on how to make a webapp can also be found in the Xojo webinars:
https://www.youtube.com/watch?v=g283Ei8tr3Y
watch starting around minute 56 for deployment options

If on the other hand you make a standalone build of you web app, you run it (the executable that xojo produced for you web app) by double clicking it or starting it from the command line, and then point your browser at the ip number of the computer you started the standalone on (127.0.0.1 if it is the same computer as the one the standalone is running on) and the port you defined in the xojo deployment settings. so for instance http://127.0.0.1:8080
This should enable you to test and run a webapp.

If all this was too complicated I suggest you start by learning how to set up cgi on your chosen webserver, and take it from there.
Webservers are not always an easy thing to work with, but as programmers and given time we should be able to figure it out.

And if you really don’t want to learn, you could use a service like Xojo Cloud.

The doc topics might help you out:

[quote=208019:@chris benton]Sorry guys for the lack of understanding. Does this mean that I can test the app online by dropping the CGI file onto a sub-directory in my domain and launch it via a URL i.e.: www.mydomain.com/app/test

If not then I am really missing something.[/quote]

If your server is ran by and for Xojo users, like 1701Software.com I have been using for a couple years, yes, all you need to do is to upload the Linux cgi build files and library, and then go http://www.mydomain.com/app/test.cgi.

Reading your initial post, though, it is very unclear. What you describe, double clicking on a cgi file and seeing it launched, does not seem like the default OS X behavior. Here, it ends up opened by TextEdit. Maybe you have already done some configuration for your Mac to support cgi.

What is your setup ? Are you going to use a Mac box as server ? Do you plan on renting space on a host ?

[quote=208173:@Michel Bujardet]Reading your initial post, though, it is very unclear. What you describe, double clicking on a cgi file and seeing it launched, does not seem like the default OS X behavior. Here, it ends up opened by TextEdit. Maybe you have already done some configuration for your Mac to support cgi.

What is your setup ? Are you going to use a Mac box as server ? Do you plan on renting space on a host ?[/quote]

In my original post I asked
“I have just built a web app in the IDE and want to deploy it. Before doing so I double clicked on the app.cgi and expected it to be launched by Safari, but instead I get a message box with the following text;
You are opening the application “IE Crash Detection — Windows XP.app” for the first time. Are you sure you want to open this application?
And before you ask, the app is creatively called ‘Test’. The build settings in the IDE are set for OSX. What is confusing for me is that I thought CGI documents were cross platform or cross browser. Any clues?”

I think that Phil Zedalis pretty well cleared up my query as I didn’t understand that CGIs can’t be run locally. I dropped my test app onto my hosted domain www.simquip.com/app/test.cgi, but all I get is a 404 error. I will check out MB’s suggestion.

Chris, I think you haven’t got your head around WE deployment just right :wink:

When you build as CGI you build and app that requires a web server like apache or IIS. The CGI script is acting as a kind of middleman that in turn talks to your built app and the users web browser.

A standalone build is your app that also acts as a web server in itself that does not require a separate web server(apache, IIS).

Standalone or CGI does not have anything to do with cross platform or not. You still need to select the target platform for your server under Build settings. What OS the user runs to access your app does not matter as it only renders the HTML/CSS to show your app.

If your app does not run on your server it “might” not be configured to allow cgi scripts to run.

Very well put Albin, maybe I’m doing too much forum surfing and not enough document reading.
BTW; how come you are always awake answering questions, you guys getting 24hours of daylight up there?

[quote=208342:@chris benton]Very well put Albin, maybe I’m doing too much forum surfing and not enough document reading.
BTW; how come you are always awake answering questions, you guys getting 24hours of daylight up there?[/quote]
I’m just up way too early and go to bed way too late.

When I stay up till 3 a.m. people say I stayed up late.
When I get up at 3 a.m. people say I got up early.
With confusion like that, it’s no wonder we don’t get enough sleep :slight_smile:

[quote=208332:@chris benton]"I have just built a web app in the IDE and want to deploy it. Before doing so I double clicked on the app.cgi and expected it to be launched by Safari, but instead I get a message box with the following text;
You are opening the application “IE Crash Detection — Windows XP.app” for the first time. Are you sure you want to open this application?
And before you ask, the app is creatively called ‘Test’. [/quote]

Chris,

I did read very carefully that sentence, and yet, I find it unclear.

Obviously, you tried to launch some app.cgi (is that the complete file name) on a Mac. As default, Mac considers a cgi file as Text. So I do not understand the error message you describe, that refers to the application “IE Crash Detection — Windows XP.app” . That makes absolutely no sense and just does not match the “Test” name of the app you tell. If I build a cgi app called “Test” for Mac, here are the files I get in the build :

test test.cgi config.cfg Resources test Libs

The last two are folders.

Nowhere is there any “IE Crash Detection — Windows XP.app". Especially, no .app bundle. If I double click on test.cgi it opens in TextEdit as a text file and shows the cgi script source. If I double click on the Unix executable test, here is what I get :

[code]Mitchs-iMac:~ Mitch$ /Users/Mitch/Desktop/Builds\ -\ test/Mac\ OS\ X\ \(Intel\)/test/test ; exit;
logout
Saving session…
…copying shared history…
…saving history…truncating history files…
…completed.
Deleting expired sessions…6 completed.

[Process completed]
[/code]

What are exactly the files in your build ?

Your description of things makes absolutely no sense whatsoever. Repeating it does not provide the very basic informations that could enable me to help.

Xojo CGI BUILDS are not cross platform. Indeed, the script in test.cgi is just a text file interpreted the same way as long as Perl is installed on the machine. Which is obviously not the case on a standard Mac.

BUT a Xojo cgi build is composed of a cgi script (test.cgi) which launches a Unix executable (test) that carries out the business of doing the actual app.

If you want assistance, you must work with people.

Apparently, the files are not in the right directory, you mistyped the name of the script, or one of the files is missing.

Make sure the build is for the server system, and copy all the files in the build within your app folder.