You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by CraigT <ct...@yahoo.com> on 2007/12/19 19:25:41 UTC

[users@httpd] Can't load .JS file into Perl/CGI script.

Hello,

I've built an app with Perl (5.8)/CGI, Javscript, and CSS.  Its running on a
Windows XP Home (development box) using Apache 2.   It is being handled by
mod_perl 2 with no errors.

My problem is that I can't load .JS files into Perl/CGI scripts running out
of the cgi-bin directory using the '<script SRC=' method.   I can't load a
.JS file from a supra-, the cgi-bin, or a sub- directory.  I have no problem
loading a .JS file in this way into a process executing out of the root
directory - the parent to the cgi-bin directory.   I'm thinking I have not
done something needed in the Apache HTTPD?   Can anyone help me.  Thanks in
advance.

Respectfully,
craigt
-- 
View this message in context: http://www.nabble.com/Can%27t-load-.JS-file-into-Perl-CGI-script.-tp14422533p14422533.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't load .JS file into Perl/CGI script.

Posted by CraigT <ct...@yahoo.com>.
Thanks again Dragon.   When I tried to load the js file directly via the
browser, it showed the problem.
I had to adapt my quoting in the .JS file to work with the new loading
approach.

craigt

 

Dragon-4 wrote:
> 
> CraigT wrote:
> 
>>Thanks for responding Dragon.   I added the JavaScript mime type to the
HTTPD
>>file.   I restarted the server and tried to load the external JavaScript
>>file into the .CGI process from the supra-directory (root) and a
>>subdirectory to the cgi-bin directory.   The load from the root did not
>>work.   The load from the subdirectory tried to work but attempted to
>>execute the .JS file like a Perl/CGI program according to the Apache log.
>>The content type is given as below.
>>
>>              <script type='text/JavaScript' src='js/rnd.js'></script>
>>
>>I need more guidance.
> ---------------- End original message. ---------------------
> 
> As I said in my original post, you cannot have these files served 
> from anywhere under the cgi-bin directory if Apache is configured to 
> execute files in that directory as CGI scripts, (which it appears it 
> is from what you say above).
> 
> I would suggest making a directory under your document root directory 
> for these js files and serve them from there.
> 
> Does your server properly send a static HTML file from the document 
> root directory or any subdirectories?
> 
> What happens if you try to load the js file directly via the browser 
> (not as part of a script tag, just type the url of the js file in the 
> browser)?
> 
> Dragon
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can%27t-load-.JS-file-into-Perl-CGI-script.-tp14422533p14442487.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't load .JS file into Perl/CGI script.

Posted by Dragon <dr...@crimson-dragon.com>.
CraigT wrote:

>Thanks for responding Dragon.   I added the JavaScript mime type to the HTTPD
>file.   I restarted the server and tried to load the external JavaScript
>file into the .CGI process from the supra-directory (root) and a
>subdirectory to the cgi-bin directory.   The load from the root did not
>work.   The load from the subdirectory tried to work but attempted to
>execute the .JS file like a Perl/CGI program according to the Apache log.
>The content type is given as below.
>
>              <script type='text/JavaScript' src='js/rnd.js'></script>
>
>I need more guidance.
---------------- End original message. ---------------------

As I said in my original post, you cannot have these files served 
from anywhere under the cgi-bin directory if Apache is configured to 
execute files in that directory as CGI scripts, (which it appears it 
is from what you say above).

I would suggest making a directory under your document root directory 
for these js files and serve them from there.

Does your server properly send a static HTML file from the document 
root directory or any subdirectories?

What happens if you try to load the js file directly via the browser 
(not as part of a script tag, just type the url of the js file in the 
browser)?

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't load .JS file into Perl/CGI script.

Posted by CraigT <ct...@yahoo.com>.
Thanks for responding Dragon.   I added the JavaScript mime type to the HTTPD
file.   I restarted the server and tried to load the external JavaScript
file into the .CGI process from the supra-directory (root) and a
subdirectory to the cgi-bin directory.   The load from the root did not
work.   The load from the subdirectory tried to work but attempted to
execute the .JS file like a Perl/CGI program according to the Apache log.   
The content type is given as below.

             <script type='text/JavaScript' src='js/rnd.js'></script> 

I need more guidance.

Thanks again.
craigt

 

Dragon-4 wrote:
> 
> CraigT wrote:
> 
>>Hello,
>>
>>I've built an app with Perl (5.8)/CGI, Javscript, and CSS.  Its running on
a
>>Windows XP Home (development box) using Apache 2.   It is being handled by
>>mod_perl 2 with no errors.
>>
>>My problem is that I can't load .JS files into Perl/CGI scripts running
out
>>of the cgi-bin directory using the '<script SRC=' method.   I can't load a
>>.JS file from a supra-, the cgi-bin, or a sub- directory.  I have no
problem
>>loading a .JS file in this way into a process executing out of the root
>>directory - the parent to the cgi-bin directory.   I'm thinking I have not
>>done something needed in the Apache HTTPD?   Can anyone help me.  Thanks
in
>>advance.
>>
>>Respectfully,
>>craigt
> ---------------- End original message. ---------------------
> 
> Your http server is probably configured to run anything in the 
> cgi-bin directory as a CGI script. So what is probably happening is 
> that the server is attempting to execute these js files and failing. 
> If that is the case, you should see log entries in the error log 
> regarding these failures.
> 
> You need to serve these files out of a different directory and you 
> also need to make sure that the mime type for them is properly 
> configured. This is because the server must serve them and not 
> execute them and the browser should be given the correct content type 
> when the file is served.
> 
> Dragon
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Can%27t-load-.JS-file-into-Perl-CGI-script.-tp14422533p14435186.html
Sent from the Apache HTTP Server - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can't load .JS file into Perl/CGI script.

Posted by Dragon <dr...@crimson-dragon.com>.
CraigT wrote:

>Hello,
>
>I've built an app with Perl (5.8)/CGI, Javscript, and CSS.  Its running on a
>Windows XP Home (development box) using Apache 2.   It is being handled by
>mod_perl 2 with no errors.
>
>My problem is that I can't load .JS files into Perl/CGI scripts running out
>of the cgi-bin directory using the '<script SRC=' method.   I can't load a
>.JS file from a supra-, the cgi-bin, or a sub- directory.  I have no problem
>loading a .JS file in this way into a process executing out of the root
>directory - the parent to the cgi-bin directory.   I'm thinking I have not
>done something needed in the Apache HTTPD?   Can anyone help me.  Thanks in
>advance.
>
>Respectfully,
>craigt
---------------- End original message. ---------------------

Your http server is probably configured to run anything in the 
cgi-bin directory as a CGI script. So what is probably happening is 
that the server is attempting to execute these js files and failing. 
If that is the case, you should see log entries in the error log 
regarding these failures.

You need to serve these files out of a different directory and you 
also need to make sure that the mime type for them is properly 
configured. This is because the server must serve them and not 
execute them and the browser should be given the correct content type 
when the file is served.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org