| Author |
help needed with an include statement
|
|
| lohroffe 2004-05-27, 2:31 am |
| I am converting some pages from asp to php. I had an include that, well,
included a javascript (on mouseover).
If I copy and paste the script code into my php file, it works fine, so it
must be my statement, which is this:
<?php
include ('./scripts/swap_functions.txt');
?>
I *do* have the swap_functions.txt in the scripts folder.
Can you tell what I'm doing wrong from this statement?
Thanks,
lohroffe
| |
| Shane Lahey 2004-05-27, 2:31 am |
| On Thu, 27 May 2004 01:03:06 -0400, "lohroffe"
<lohroffe@nospamplease.com> wrote:
>I am converting some pages from asp to php. I had an include that, well,
>included a javascript (on mouseover).
>
>If I copy and paste the script code into my php file, it works fine, so it
>must be my statement, which is this:
>
><?php
>include ('./scripts/swap_functions.txt');
>?>
>
>I *do* have the swap_functions.txt in the scripts folder.
>
>Can you tell what I'm doing wrong from this statement?
>
>Thanks,
>lohroffe
>
try:
<?php
require_once('scripts/swap_functions.txt'); // does this work?
?>
| |
|
| lohroffe wrote:
> I am converting some pages from asp to php. I had an include that,
> well, included a javascript (on mouseover).
>
> If I copy and paste the script code into my php file, it works fine,
> so it must be my statement, which is this:
>
<?php
include ('./scripts/swap_functions.txt');
>
Is this 'greater-than' angle bracket supposed to be a closing php tag or is
it just a typo? If so, then it should be '?>'
Also try two dots before the subdirectory slash - '../scripts/'
Neil
| |
|
|
> <?php
> include ('./scripts/swap_functions.txt');
>
> Is this 'greater-than' angle bracket supposed to be a closing php tag or
is
> it just a typo? If so, then it should be '?>'
> Also try two dots before the subdirectory slash - '../scripts/'
on my news client it showed perfectly fine
<?php
include ('./scripts/swap_functions.txt');
?>
is what I saw also I should imagine that the script calling the text file is
in the same folder as the scripts folder so no need to go up a directory
(although I am making an assumption here)
| |
|
|
"Filth" <p.macdonald@blueyonder.co.uk> wrote in message
news:Yvktc.4175$Dm2.3277@front-1.news.blueyonder.co.uk...
>
> is
>
> on my news client it showed perfectly fine
>
> <?php
> include ('./scripts/swap_functions.txt');
> ?>
>
> is what I saw
<snip>
Oops! I was using QuoteFix
http://www.aminautes.org/forums/con...tml#description and it
seems to be parsing/escaping out some characters - sorry about that :-|
Neil
| |
| lohroffe 2004-05-27, 1:31 pm |
| Filth said:
> Also try two dots before the subdirectory slash - '../scripts/'
> snip <
> is what I saw also I should imagine that the script calling the text file
is
> in the same folder as the scripts folder so no need to go up a directory
> (although I am making an assumption here)
I tried the following
<?php
include ('./scripts/swap_functions.txt');
?>
with '../scripts (two dots and a slash) and with 'scripts (no dot slash) and
neither worked.
The scripts directory is at the same level as the php page. In the past
when I've set up my directory structure this way I just use 1 dot so it
won't go look in the root directory.
Any other ideas?
tia,
lohroffe
| |
| lohroffe 2004-05-27, 1:31 pm |
| Shane wrote:
> try:
>
> <?php
>
> require_once('scripts/swap_functions.txt'); // does this work?
>
> ?>
Didn't work (tried it with 'scripts and './scripts).
Any other ideas?
tia,
lohroffe
| |
|
| > I tried the following
>
> <?php
> include ('./scripts/swap_functions.txt');
> ?>
>
> with '../scripts (two dots and a slash) and with 'scripts (no dot slash)
and
> neither worked.
>
> The scripts directory is at the same level as the php page. In the past
> when I've set up my directory structure this way I just use 1 dot so it
> won't go look in the root directory.
ok do it as follows:-
require_once "scripts/swap_functions.txt";
if that does not work try the absolute path to the script
| |
| lohroffe 2004-05-27, 9:31 pm |
| > ok do it as follows:-
>
> require_once "scripts/swap_functions.txt";
>
> if that does not work try the absolute path to the script
Tried both the above and with the absolute path. Still didn't work.
Then I had a crazy thought - maybe it's our server. So I uploaded both my
php page and my script (in a scripts directory) onto a site (and totally
different server) that I *know* does php correctly.... worked!
It's my freaking server!!!! :-( Apparently it will read and display php
pages, just don't ask it to execute php statements!
Thanks to all of you for your help - sorry I bothered you!
lohroffe
| |
| Shane Lahey 2004-05-27, 9:31 pm |
| On Thu, 27 May 2004 20:31:23 -0400, "lohroffe"
<lohroffe@nospamplease.com> wrote:
>
>Tried both the above and with the absolute path. Still didn't work.
>
>Then I had a crazy thought - maybe it's our server. So I uploaded both my
>php page and my script (in a scripts directory) onto a site (and totally
>different server) that I *know* does php correctly.... worked!
>
>It's my freaking server!!!! :-( Apparently it will read and display php
>pages, just don't ask it to execute php statements!
>
>Thanks to all of you for your help - sorry I bothered you!
>lohroffe
>
HAVE YOU TRIED WHAT I SAID LAST????? :D
<!---- cut n' paste from previous post ---->
actually ... YES
do your webserver have READ permission of the file?
...
... try setting file permissions correctly :D
...
chmod 0755 ./scripts
chmod 0644 ./scripts/swap_functions.txt
...
...
now try again.
| |
| lohroffe 2004-05-28, 11:32 am |
| Shane said:
> HAVE YOU TRIED WHAT I SAID LAST????? :D
I'm assuming you mean the require_once statement....yes, I posted on 5/27
that I tried it and it didn't work.
> <!---- cut n' paste from previous post ---->
Not sure what previous post ^ you were referring to.
> do your webserver have READ permission of the file?
well, not sure now if I can even USE php. I'm asking my hosting company
..... however, I DO know I can't do chmod command because it's an NT server,
not unix.
thanks again, all for your help!
lohroffe
| |
| Shane Lahey 2004-05-31, 4:31 am |
| On Thu, 27 May 2004 12:54:27 -0400, "lohroffe"
<lohroffe@nospamplease.com> wrote:
>Shane wrote:
>
>Didn't work (tried it with 'scripts and './scripts).
>
>Any other ideas?
>tia,
>lohroffe
>
actually ... YES
do your webserver have READ permission of the file?
...
... try setting file permissions correctly :D
...
chmod 0755 ./scripts
chmod 0644 ./scripts/swap_functions.txt
...
...
now try again.
|
|
|
|