PlugIt Script

software development

#1

I am trying to install a simple CGI script on a domain. It’s called PlugIt and is designed to show a predetermined file of text on a page. I cannot get this script to show the text file with my predetermined text. The server is recogizing someting, however:

http://www.1st-albuquerquehomes.com/partners.shtml

The above page contains the code that is hidden because it is a server side include.

Below is a link to the zip file containing the script:

http://www.1st-albuquerquehomes.com/plugit.zip

The file itself contains installation instructions.

Please help!


#2

First of all you probably don’t need to use this script in the first place!

Second of all, DreamHost doesn’t have “exec” enabled for SSI, you must use “include virtual” instead, which performs a sub-request of a URL.

Let’s say your text file is /home/username/example.com/status.txt

Then in your HTML document you would use:

<!--#include virtual="/status.txt" -->Which causes Apache to fetch the content from http://example.com/status.txt

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#3

Great, that works for one domain. Now how do I get one text file to work across several domains without having to upload the file to each and every one of them???

I am not the brightest tool in the shed, but I learn quickly.


#4

Well you have 2 or 3 options…

  1. Use a copy of the script on each domain
  2. Use a symlink to the file
  3. Create aliases for each domain to a single directory using “Remap Sub-dir” in the web panel, eg http://example.com/global/ and http://localhost/global/ both map to /home/username/global
    and then the url would be /global/status.txt for each domain

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#5

I like option 3, because it involves on file for all the domains. I got as far as “single directory” and you lost me. Where do I put “Remap Sub-Dir”? In what form does it exist? Do I FTP it or is there something I have to change in the control panel?

Think of me as someone who absolutely knows nothing past basic HTML.

I am not the brightest tool in the shed, but I learn quickly.


#6

Ok, I saw where in the web panel you put a Remap Sub-Dir, but it still only works one domain at a time.

I have one objective and that is to make one file work across all my domains. I have literally dozens of them and updating this one aspect of them takes hours. Because the update is identical from domain to domain, it would make it easier to just do it once, upload it and get on with my life.

How do I create aliases?

I am not the brightest tool in the shed, but I learn quickly.


#7

OK, here’s what I created in the web panel:

http://www.domain1.com/global/ maps to /home/username/global/

This trick only works when the file “status.txt” is uploaded to that particular domain. I have tried, unsuccessfully to get it to work on another domain. For instance, using the code
on domain2.com in exactly the same fashion reveals this:
[an error occurred while processing this directive]

The only way to get it to work is to upload the status.txt file to that domain as well, and to every other domain on the list.

I created a Remap Sub-Dir for other domains as well to see if it would work then, but it does not. I still have to upload the file to each and every domain. This is what I am trying to avoid.

I am not the brightest tool in the shed, but I learn quickly.


#8

Also, you lost me with the localhost.com… There isn’t a domain in the list called “localhost.com

I am not the brightest tool in the shed, but I learn quickly.


#9

[quote]http://www.domain1.com/global/ maps to /home/username/global/

This trick only works when the file “status.txt” is uploaded to that particular domain. I have tried, unsuccessfully to get it to work on another domain. For instance, using the code
on domain2.com in exactly the same fashion reveals this:
[an error occurred while processing this directive][/quote]
When an error occurs check the error log file called error.log in the logs directory for the domain.

Also don’t just assume the include will work. You should be able to visit both the global directory and the status.txt file itself in the browser:
eg

file: /home/username/global/status.txt
Remap Sub-dir: http://example.com/global/ maps to /home/username/global/

Browse: http://example.com/global/ (should get a directory index)
Browse: http://example.com/global/status.txt (should get the text file)

If you can browse to both of those then the following should work:

<!--#include virtual="/global/status.txt" -->Given the HTML document is accessed from http://example.com/

This works for me. Have you setup each domain to run CGI as different users?

PS. ‘localhost’ is a hostname for "the currently used system"
And while example.com is an active domain it is to be used for the purposes of documentation.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#10

I get the directory.
I get the file.
I get the thing to work.
But on only one domain.

If I try to add the include text on another domain, it doesn’t work. The only way I can get it to work on my other domains is to duplicate your steps for EACH DOMAIN.

I am not the brightest tool in the shed, but I learn quickly.


#11

Run CGI as different users? No. If that is important, then you left out that part. All the domains I am talking about are under one user. Do I need to put them under other users and how do I do that?

I am not the brightest tool in the shed, but I learn quickly.


#12

Apparently I don’t know enough about how your domains are set up.

You will have to do something for each domain. You’ll either have to have a separate copy of the PlugIt script or you will have to add an alias for each domain using Remap Sub-dir.

So here’s a walk through of using Remap Sub-dir:

  1. Make the directory /home/username/global and upload the text file there, eg “filename.txt”
  2. For each domain, upload the HTML file eg “statistics.shtml” to the web directory with the following include:

<!--#include virtual="/global/filename.txt" -->2. For each domain, in the web panel use Remap Sub-dir to map
http://domain/global/ to /home/username/global/
3. For each domain, verify that http://domain/global/ shows a directory index
4. For each domain, verify that http://domain/global/filename.txt shows the text file contents
5. For each domain, verify that http://domain/statistics.shtml shows the web page with the text file contents included.

It should be this simple and should work even if you were using more than one user, given that the permissions and ownership are compatible.

The first mistake that comes to mind is getting the virtual parameter wrong. It is a local url-path (no scheme and hostname), not a filesystem path. It should be relative to the document url or absolute where the web directory is root. That is to say

<!--#include virtual="http://domain/global/filename.txt" -->is not correct form and will not work.

When you get an error from the web site you will need to consult the error log file to determine what caused the error. Unless you can tell me the cause of the error you should either contact support or contact me privately.

I have used the same “trick” for a couple of years now to manage CSS and image files across more than one domain without problems.

:cool: openvein.org -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


#13

I have followed your instructions to a tee. Unless the file exists in the domain directory for that particular domain, it doesn’t work. I have a folder called “global” sitting in the main directory next to all the folders for each domain. I have instructed the remap sub-dir to for a test domain to point to that folder. Unless the file exists on that particular domain, I get an error.

I get the feeling there is an extra step you haven’t told me about… i.e. you have given me steps b through d, but left out step a. It’s easy to assume I have already done “step a”, because it’s a no-brainer. Please don’t assume!

Let me drive home the point: You assume I know how to check error logs… I Don’t!!!

I am not the brightest tool in the shed, but I learn quickly.