Thank you for your great feedback! I'll answer you now:
Must admit that I am a little confused about the installation instructions?
It's very simple. Get PureBasic and extract it on your local PC. Then you take the source code of the PB Interpreter and compile it, in order to put it into the PB directory. This PB directory is to be uploaded 'as is' to your server. On my Linux server, I uploaded PureBasic to /pb, because then the path is short and my shebang-line will also be short (but on Linux, you can use every other directory, too as you can create SymLinks to achieve short path names).
After this upload process, you should have a look at the permissions; give the whole PB directory 755-rights (also applay these 755-rights to the interpreter, the PB compiler, etc...).
When Apache calls a CGI-Script, this CGI skript might run under another account name other than you used to upload PureBasic. Example: I logged into my FTP-Server with root-rights. The owner of the PB folder now is 'root'. In further times this was a problem, because Apache runs my CGI Scripts under the 'wwwrun' account (an account with limited rights). So be sure you give all user accounts access to the PB directory, or make the used useraccounts matching. I hope you understood this part?
Then go into your cgi-bin directory and create a file named "test.cgi". Type in the shebang-line containing the path to the interpreter. The rest is pure PureBasic: open a console, write a HTTP-header followed by any data you like. This could be plain text, HTML, whatever. Use the hello-world-example, if you don't know what to write.
Save this file and
don't forget to give this file also 755-rights! Otherwise it cannot be executed by Apache (this is my most frequently mistake, when I wonder why nothing is working).
I compile your code to "interpreter.exe" and place it in my /pb installation folder - is that correct?
Err... Yes.
Remember to adjust the code where neccessary, because it was written for Linux. But there is not so much to do: Only change some paths (the / and \ thing).
However, have to be rock solid for security reasons, checking all input variables, and so on.
Actually, this has do be done in every language. In PureBasic there is no
eval() function, to wich noobs can pass their input variables.
Also keep in mind that the executable can use commands like
Get/SetCurrentDirectory(),
ProgramFilename(),
RunProgram(), etc. This enables you to read your current dir, get to know your actual program filename and to run other, external programs. As long as only you are using this, it might not be a problem. But don't forget that you can also use the OS's API or the commandline within your program.
Be also sure not to upload PB and the PB Interpreter into your httpdocs. This was my first attempt and it worked. But then I found out how to store PB outside of my webspace and now it works too.
I am still unsure whether I can upload the PB installation safely?
Try to access
http://www.and51.de/purebasic , this is the directory to which I uploaded PureBasic the first time. Only noobs (like me) upload a complete PB installation to the webspace. That's why I'm going do delete it soon. But the point is that it is safe, because you can protect PureBasic from being downloaded via .htaccess for example:
You won't need this .htacces, if you store PB somewhere outside your webspace on your server.
Actually I didn't think my hosting service would allow exe's to run in my cgi-bin folder; quite a surprise when it worked! I thought that was just for Perl scripts!
Well this often depends on what server type you have. Obviously, you do not have a simple webspace, but a (virtual) server. So you can run every services and programs. For example, I run TeamSpeak, TacticalOps and BOINC on my virtual server.
The second factor is Apache's configuration. PHP and Perl are so famous, that Apache is pre-configured by default to support PHP and Perl. Sometimes, you don't even need to type shebang-lines in Perl-Scripts, because Apache is so cifigured that it searches the PATH-variable to find the Perl-Interpreter. If you've got enough knowledge, you can also modify your Apache to find the PB Interpreter automatically.
This opens up some nice possibilities! Though I know others have been doing this for years!
Well, I got this idea when I wanted to write a "real" counter. A counter, not a hitcounter. So I must store the IP addresses and timestamps to check, if a visitor is there for the first time (then increase counter) or not. I got this working in Perl it was too %!$"(/%, although I love Perl. I wanted to use a language I use every day: No not German, but PureBasic!
It took me ~1 month to create the PB Interrpeter, but I didn't realized a simple counter yet.

I was too busy with publishing it in the forums and play around with it.
@AND51 : have you checked with Fred that our PB license allows the compiler to be used in this way?
The license allows you to use PureBasic on every computer that you own. But
only you may use PureBasic.
If you are still very unsure, you can also try this with the
demo version of PureBasic, since it is free for every one. But then you get limited to 800-lines-only and an always-on-debugger.
I can't imagine you can do this with Linux binaries. Does anyone know if it's possible?
Of course, it is. The cgi-bin in Apache is given "ExecCGI" rights which advises Apache first, to execute the file if possible. If it's an executable, it's executed; if it's a script, it's sent to the specified interpeter.
Every directory hat you enable with "Options +ExecCGI" directive, will turn into a cgi-bin.
What happens if multiple people access the site at the same time?
No problem in version 1.0, no problem in version 1.1.
In v1.0 the PB Interpreter generates a
unique filename for the executable. So it cannot be run twice. You can also call the PB Interpreter or the PB compiler itslef twice. This will result into 2 different processes which won't influence each other.
Version 1.1, however, compiles again only when neccessary. If you then call the executables twice, this is no problem, too. This also results in 2 independent processes.
Just be careful with the ressources, you use! Don't block an external file with
OpenFile(), for example!
In Perl there is a command named
flock(), acting like a kind of global mutex. In PureBasic you must find your own solution. But I plan to write those functions. Yesterday I read that
flock() is a Linux-API, so obviously you can also use those functions in PB.
(flock is to prevent different processes from accessing the same file. If one process finishes, the next process gets access to the file. It works just like
LockMutex() and
TryLockMutex() commands in PB.)
However, it might take some time till I can present you a nice include providing those functions.
just saw the bit about the v1.1 version - any chance of seeing this versions source?
Yes, of course.
Since you gave me so nice feedback and expressed your interest, I'll release it, too. Just give me some time, please.