471,602 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,602 software developers and data experts.

script help

i installed apache 2.2 on winxp with php5. when i write a piece of
html and include a php or java script in the html i have no problem.
when i file the script and use something like
<script src="script.php"></script>
i get nothing. he finds the file - if i rename it - he complains.
i'm guessing a config param. please help.

Sep 15 '06 #1
5 1318
hoozdiss wrote:
>
i installed apache 2.2 on winxp with php5. when i write a piece of
html and include a php or java script in the html i have no problem.
when i file the script and use something like
<script src="script.php"></script>
i get nothing. he finds the file - if i rename it - he complains.
i'm guessing a config param. please help.
You made two substantial mistakes.

1) If you use the HTML <scripttag you must tell the user agent which
language it is written in.

e.g. <SCRIPT type="text/vbscript"
src="http://someplace.com/progs/vbcalc">

2) The <scripttag is for client side scripting only! The server should
just pass the script to the user agent which should execute it.
If you want to include PHP scripts from a file use

<?php
include("/path/script.php");
?>

Bye!
Sep 15 '06 #2
On Fri, 15 Sep 2006 14:54:48 -0400, hoozdiss <Bi***@msn.comwrote:
>i installed apache 2.2 on winxp with php5. when i write a piece of
html and include a php or java script in the html i have no problem.
when i file the script and use something like
<script src="script.php"></script>
That's specifying a client-side script to run, which is probably not what you
want (unless the PHP script is itself generating Javascript, for example).

You probably want to use require() or similar in a PHP block.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Sep 15 '06 #3
i'm trying to run scripts like site counters etc. right now i just
have small test scripts -

</head>

<body>
this is a test
<script type="text/javascript"
src="http://192.168.123.162/test/scriptA.php"></script>
<br>and this<br>
<script src="http://localhost/test/calendar.php"></script>
try this-<br>
<script type="text/javascript" src="scriptJ.js"></script>
<br>
<script type="text/javascript">
document.write("this part works")
</script>
<br>
try include
<?php
include("scriptA.php");
?>

etc.
i keep the script files in the same directory as the html-
....Apache2.2\htdocs\test
if i delete them - there's a msg in the log so he knows they're there.

i don't know about using script type= javasript with php - am i
missing something here? but even the js doesn't work (except the
inline one).


Sep 15 '06 #4
hoozdiss wrote:
i'm trying to run scripts like site counters etc. right now i just
have small test scripts -

</head>

<body>
this is a test
<script type="text/javascript"
src="http://192.168.123.162/test/scriptA.php"></script>
<br>and this<br>
<script src="http://localhost/test/calendar.php"></script>
try this-<br>
<script type="text/javascript" src="scriptJ.js"></script>
<br>
<script type="text/javascript">
document.write("this part works")
</script>
<br>
try include
<?php
include("scriptA.php");
?>

etc.
i keep the script files in the same directory as the html-
...Apache2.2\htdocs\test
if i delete them - there's a msg in the log so he knows they're there.

i don't know about using script type= javasript with php - am i
missing something here? but even the js doesn't work (except the
inline one).

There is no difference between using a script tag in PHP and in HTML (as
long as the tags aren't in a PHP block, of course).

First of all try getting it to work in a simple html page. Once you get
it to work there, it will work in this page.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 15 '06 #5
god - been working on this all day - finally found it - you can tell
i'm new to this. my apache install was vanilla - i used htdocs for
initial testing then added a test directory under that which is where
i tested the scripts. they didn't work until just now when i added
the test directory and "Options +Includes" to the httpd.conf file.
i really thought that was supposed to trickle down. anyway thanks for
all offers of help.
Sep 15 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by hupjack | last post: by
8 posts views Thread by Johnny Knoxville | last post: by
9 posts views Thread by Harry Smith | last post: by
3 posts views Thread by David | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.