1. include files on cgi-bin
- Posted by achury Mar 20, 2022
- 2484 views
In orden to run cgi-bin programs on a web server, I have copied /std folder inside /public_html/cgi-bin
Any suggestion for better practices?
Marco Achury
2. Re: include files on cgi-bin
- Posted by ghaberek (admin) Mar 23, 2022
- 2382 views
In orden to run cgi-bin programs on a web server, I have copied /std folder inside /public_html/cgi-bin
Any suggestion for better practices?
I going to assume you're running Apache web server on a Debian-based Linux distribution. Here is what I typically do.
Step 1: Download Euphoria 4.1 64-bit from GitHub.
$ wget -q https://github.com/OpenEuphoria/euphoria/releases/download/4.1.0/euphoria-4.1.0-Linux-x64-57179171dbed.tar.gz
Step 2: Extract only the bin and include directories to /usr/local/euphoria-4.1.0-Linux-x64.
$ sudo tar -C /usr/local -xzf euphoria-4.1.0-Linux-x64-57179171dbed.tar.gz euphoria-4.1.0-Linux-x64/{bin,include}
Step 3: Symlink the executables from bin directory into /usr/local/bin (which should be in the environment PATH).
$ cd /usr/local/bin $ sudo find /usr/local/euphoria-4.1.0-Linux-x64/bin -type f -executable -exec ln -s {} \;
The trick here is that the eu.cfg in that package points to the directory where we put the files, including the -i option which indicates where to look for include files.
$ cat /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.cfg [all] -d E64 -eudir /usr/local/euphoria-4.1.0-Linux-x64 -i /usr/local/euphoria-4.1.0-Linux-x64/include [translate] -arch ix86_64 -gcc -con -com /usr/local/euphoria-4.1.0-Linux-x64 -lib-pic /usr/local/euphoria-4.1.0-Linux-x64/bin/euso.a -lib /usr/local/euphoria-4.1.0-Linux-x64/bin/eu.a [bind] -eub /usr/local/euphoria-4.1.0-Linux-x64/bin/eub
-Greg
3. Re: include files on cgi-bin
- Posted by dr_can Mar 25, 2022
- 2331 views
Thank you Greg for the excellent installation advice.
Broadening the topic slightly: can you give correspondingly good advice on the location of 'so' files for best Euphorian access. (I ask because I have two machines with near identical setups, where open_dll can "find" all my 'so's in one case whereas in the other case it can only find some - not none, though!)
4. Re: include files on cgi-bin
- Posted by ghaberek (admin) Mar 27, 2022
- 2257 views
Thank you Greg for the excellent installation advice.
Broadening the topic slightly: can you give correspondingly good advice on the location of 'so' files for best Euphorian access. (I ask because I have two machines with near identical setups, where open_dll can "find" all my 'so's in one case whereas in the other case it can only find some - not none, though!)
Anything you're installing by hand should go into /usr/local/lib, which should be in the default search path for shared libraries on common distros like Debian, Ubuntu, Fedora, etc.
Euphoria relies on dlopen() so reading that man page helps understand how it's searching and why the loading can fail.
Unfortunately the man page outright states, "if dlopen() fails for any reason, it returns NULL." So working out "cannot find" versus "cannot load" can be tricky.
If you've got your libraries in /usr/local/lib, if they still aren't loading, run them through ldd and look for instances of not found. These are dependencies you need to resolve.
If you're missing any dependencies, you'll get output similar to this:
$ ldd /usr/local/lib/libname.so | grep 'not found' libsomething.so => not found
If you're on Debian/Ubuntu/etc. and are unsure which package is required to install the missing library, you can try searching with apt-file.
$ sudo apt install apt-file $ sudo apt-file update $ apt-file find libsomething.so
-Greg
5. Re: include files on cgi-bin
- Posted by dr_can Mar 27, 2022
- 2223 views
Greg
Thank you for this. I read the dlopen manual page and managed to solve the problem. For the record I think my issue was one of dependencies within 'so's, so that once the core library was recognised by dlopen then all the "children" were OK as the "parent" was then found.
The general information and approach is so useful that I think it should be stored somewhere for others to access. For my part I have copied it and stored it on my machine.
Many thanks
Charles
6. Re: include files on cgi-bin
- Posted by achury 2 months ago
- 1047 views
Back this theme.
On a shared linux web hosting, with apache server, without terminal access. Only ftp or panel file manager.
What is the best location for euphoria interpreter and includes?
On Eu31 there was a cgi.doc mini guide. Such instructions are today a good option?
Best regards
Marco Achury
7. Re: include files on cgi-bin
- Posted by ghaberek (admin) 2 months ago
- 1040 views
What is the best location for euphoria interpreter and includes?
I assume you want to use Euphoria 4.1 for this and not anything earlier. You're likely on 64-bit Linux and Euphoria 4.1 is the only available 64-bit build.
https://github.com/OpenEuphoria/euphoria/releases/tag/4.1.0
Assuming your web files are in /home/user/public_html I recommend extracting the Euphoria package to /home/user/euphoria.
Edit the Euphoria configuration file /home/user/euphoria/bin/eu.cfg to reflect its current location:
[all] -d E64 -eudir /home/user/euphoria -i /home/user/euphoria/include [translate] -arch ix86_64 -gcc -con -com /home/user/euphoria -lib-pic /home/user/euphoria/bin/euso.a -lib /home/user/euphoria/bin/eu.a [bind] -eub //home/user/euphoria/bin/eub
(You can probably leave out the [translate] and [bind] sections since you're not using those.)
Add the following settings to your .htaccess file at /home/user/public_html/.htaccess:
# Add CGI handler AddHandler cgi-script .ex DirectoryIndex index.ex Options +ExecCGI # Deny access to these files <Files ~ ".(cfg|err|edb)$"> Deny from all </Files>
Create your CGI scripts and make sure they have execute permissions (755) and a shebang on the first line.
#!/home/user/euphoria/bin/eui -- the rest of your app here
That should do it. I'm still using this method to run this website on an ISPConfig shared host. (ISPConfig is an alternative to CPanel.)
-Greg
8. Re: include files on cgi-bin
- Posted by achury 2 months ago
- 989 views
Thank you.
Your instructions works great. Apache on Linux64 server with CPANEL.
I only copied to the server /bin and /include I think will not need anything else to run my scripts.
I like your approach. I used to put interpreter, include files and scripts on /cgi-bin.
9. Re: include files on cgi-bin
- Posted by ghaberek (admin) 2 months ago
- 987 views
I only copied to the server /bin and /include
Good call. I typically do that as well but forgot to mention. You can probably also remove the "legacy" files in the root of include/ and the std/net and std/win32 folders.
I like your approach.
Thanks! I appreciate the feedback.
-Greg
10. Re: include files on cgi-bin
- Posted by katsmeow 2 months ago
- 996 views
Thank you Greg for the excellent installation advice.
Really! Sure beats "download zip file to c:\Euphoria\ and unzip there, and you're ready to go!". But then, we've had 25 years of advancement since the olden daze.
Kat