cgi on local windows and remote linux

Problems with the Windows version of XAMPP, questions, comments, and anything related.

cgi on local windows and remote linux

Postby Joe_Austin » 18. March 2008 15:58

I am new to xampp and am trying to set up a website for testing on a local xampp server. Up till now the site has been designed locally and uploaded to my webhost for testing.

But now I want to start adding some dynamic content and do testing locally. I have set up xampp on a Windows xp platform. I have configured my site to work via an alias in http.conf (the site is not in the /htdocs directory), and everything works except for my formmail.

When submitting the formmail Windows wants to download the .cgi script intstead of the server executing it. I assume this is because my script is in a /cgi-bin/ in my site directory and not in the proper xampp directory , correct? Having the script in my own /cgi-bin is how it works on my webhost server.

How can I set up the formmail and cgi script to work on the local server and still work when I upload to the remote server?

Also , the shebang line in the script is set up for linux (usr/bin/perl, on the remote) , how can I make it work in Windows without having to change the shebang line each time I upload to my webhost?

Thanks,
Joe.
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Postby Joe_Austin » 18. March 2008 23:54

After reading this :

http://www.mydigitallife.info/2005/10/1 ... indows-xp/

I tried commenting out the existing Scriptalias for cgi-bin, I also tried substuting my own Scriptalias. Neither worked. The browser want to download the script , not execute it.
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Re: cgi on local windows and remote linux

Postby Milligan » 19. March 2008 01:21

Last edited by Milligan on 17. July 2008 05:16, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Joe_Austin » 19. March 2008 02:28

I can't seem to get it to work. Here is the alias section from my httpd.conf:
My installation of xampp did not have the apache/conf/extra folder with the httpd-xampp.conf file so I made changes to httpd.conf.

Code: Select all
#
# Aliases: Add here as many aliases as you need (with no limit). The format is
# Alias fakename realname
#
# Note that if you include a trailing / on fakename then the server will
# require it to be present in the URL.  So "/icons" isn't aliased in this
# example, only "/icons/".  If the fakename is slash-terminated, then the
# realname must also be slash terminated, and if the fakename omits the
# trailing slash, the realname must also omit it.
#
# We include the /icons/ alias for FancyIndexed directory listings.  If you
# do not use FancyIndexing, you may comment this out.
#
Alias /icons/ "E:/server/xampp/apache/icons/"

<Directory "E:/server/xampp/apache/icons">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Alias /mysite "E:/Sites/mysite"

<Directory "E:/Sites/mysite">
    Options Indexes MultiViews
#   AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


#
# This should be changed to the ServerRoot/manual/.  The alias provides
# the manual, even if you choose to move your DocumentRoot.  You may comment
# this out if you do not care for the documentation.
#
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
#ScriptAlias /cgi-bin/ "E:/server/xampp/cgi-bin/"
ScriptAlias /cgi-bin/ "E:/sites/mysite/cgi-bin/"

#
# "E:/server/xampp/apache/cgi-bin" should be changed to whatever your SriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/sites/mysite/cgi-bin/">
#    AllowOverride None
    Options Indexes ExecCGI
     Order allow,deny
    Allow from all
</Directory>

#

The alias seems to be working , but not the scriptalias. My .cgi file still wants to download each time it is called.

Is there something I left out? AddHandler? Does the presence of ExecCGI in other places interfere with the script alias?

Thanks,
Joe.
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Postby Milligan » 19. March 2008 03:03

Last edited by Milligan on 17. July 2008 05:17, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Joe_Austin » 19. March 2008 12:58

It looks like I did follow a link to an older version (1.5) of xampp. I tried to paste in your code and became mired in syntax and <IfModule> errors.

I will re-install xampp (1.6.6?) and try again.
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Postby Joe_Austin » 19. March 2008 13:47

I uninstalled 1.5 and installed 1.6.6 and now have a httpd.conf that looks like your example.

I have added the alias and script alias sections thus:

Code: Select all
<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to
    # exist in your server's namespace, but do not anymore. The client
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar

    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.
     
     Alias /JoeAustinPhotography “E:/Sites/JoeAustinPhotography”

      <Directory "E:/Sites/JoeAustinPhotography">
       Options Indexes
       Order allow,deny
       Allow from all
       </Directory>
    #
    # ScriptAlias: This controls which directories contain server scripts.
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "E:/Sites/JoeAustinPhotography/cgi-bin/"

</IfModule>

#
# "E:/xampp/cgi-bin" should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "E:/Sites/JoeAustinPhotography/cgi-bin/">
   Options Indexes ExecCGI
    Order allow,deny
    Allow from all
</Directory>


Unless I missed something I believe this covers all the bases , but the alias no longer works. In the old version the alias worked , the script alias didn't.

Now when I try to http to any page in the site I get this error:

    [Wed Mar 19 08:34:50 2008] [error] [client 127.0.0.1] File does not exist: E:/xampp/htdocs/JoeAustinPhotography


For some reason the alias is not being used. Is there a switch in this version that has to be set in order to use aliases?

Thanks,
Joe
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Postby Milligan » 20. March 2008 01:28

Last edited by Milligan on 17. July 2008 05:18, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Joe_Austin » 20. March 2008 02:30

I added the line

127.0.0.1 JoeAustinPhotography

just under the 127.0.0.1 localhost line in the host file. These are the only two uncommented lines in the hosts file. I then rebooted, cleared the browser cache, and restarted apache.

Using 'http://localhost/JoeAustinPhotography' or 'http://localhost/JoeAustinPhotography/about.htm' in the browser I get the exact same error log message that I reported above.

The funny thing is , the alias was working in the old installation (it was the script alias that was not) without having to change the hosts file.

I don't get it.
Joe_Austin
 
Posts: 21
Joined: 14. March 2008 21:55

Postby Milligan » 20. March 2008 02:54

Last edited by Milligan on 17. July 2008 05:20, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby sari42 » 20. March 2008 10:20

>I then rebooted, cleared the browser cache, and restarted apache.
no reboot or restart needed after changes in the hosts file

having
127.0.0.1 localhost JoeAustinPhotography
in the hosts file means that
'http://JoeAustinPhotography' ,
'http://localhost' and
'http://127.0.0.1'
all point to the document root (xampp/htdocs/)

I didn't read the whole thread - but having
Alias /JoeAustinPhotography "E:/Sites/JoeAustinPhotography"
means that you have to point your browser at
'http://localhost/JoeAustinPhotography/'
to acces the html/php files in E:/Sites/JoeAustinPhotography

note: even on windows an "alias" is case sensitive:
'http://localhost/joeaustinphotography/' won't work!
Last edited by sari42 on 20. March 2008 10:45, edited 2 times in total.
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby Milligan » 20. March 2008 10:43

Last edited by Milligan on 17. July 2008 05:21, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby Milligan » 20. March 2008 10:59

Last edited by Milligan on 17. July 2008 05:22, edited 1 time in total.
Milligan
 
Posts: 136
Joined: 03. March 2008 06:23

Postby sari42 » 20. March 2008 11:05

127.0.0.1 JoeAustinPhotography
just under the 127.0.0.1 localhost line in the host file.
---8<---
Using 'http://localhost/JoeAustinPhotography' ...I get the exact same error log message that I reported above


Milligan wrote:
Sari42 wrote:I didn't read the whole thread

Don't you think that is required then?

No, I just wanted to point Joe to the fact that both JoeAustinPhotography and localhost now means "almost the same" as 127.0.0.1

and http://localhost/JoeAustinPhotography doesn't reflect to that change in "hosts"

well, as I said : maybe I should have read the whole thread before hitting the send button ...
Last edited by sari42 on 20. March 2008 11:18, edited 1 time in total.
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Postby sari42 » 20. March 2008 11:08

Milligan wrote:
Sari42 wrote:'http://JoeAustinPhotography' or 'http://JoeAustinPhotography/about.htm'
in the browser

That didn't work for me, and I tested my reply details before posting, just tries to load the xampp folder and I did explain why this happens and how to fix it, had you read all the posts in full.

but that is how the "hosts" file works ...
sari42
 
Posts: 800
Joined: 27. November 2005 18:28

Next

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 134 guests