Help! Nothing happens when I run script

Hi Everybody,

Well, I wrote WXSIM, but I don’t know much about PHP! :frowning:

I’ve just now been trying to get Ken’s PHP script to produce the type of forecast output that most of my users are now doing regularly. I successfully tested to see that my server will execute PHP files, by using the little test script on Ken’s site, calling it test.php, uploading it, and opening it in a browser.

I’ve uploaded all the carterlake icons to a /forecast/images subdirectory, and uploaded both the plaintext-parser_php.htm and plaintext-parser-data.txt files to my root directory, the former with only the slight modification of changing the forecast site name. When I try to open the plaintext-parser_php.htm in IE, it just displays the contents of the script (as if I wanted to edit it), instead of “doing” anything. I wondered if the problem was the .htm ending, so I renamed it as wxsimphp.php, but with the same result. It’s at www.wxsim.com/wxsimphp.php.

I’m guessing - hoping at least - this is something simple.

Thanks in advance for any help! :slight_smile:

Tom Ehrensperger

look at the source when you browse to it, i think you edited the page with something,but NOT a text-editor like notepad or so
all those > and < are replaced with < and >
i think that is the problem

Jozef

Thats what it looks like…

Here’s a sample of what I see in the source:

<?php

Perhaps download a new copy and do the editing with notepad. - Jim

Thanks for the suggestions. I had edited it in Notepad, though it briefly tried to open up in Word at one point (I don’t think I had saved that). Anyway, I downloaded it again and edited with Notepad, and it still didn’t work. So, I downloaded it again and uploaded it to my site totally unaltered. I tried opening again in IE, and exactly the same thing - it just opens showing the contents of the script.

Here’s where I have it:

http://www.wxsim.com/plaintext-parser_php.htm

I have the plaintext-parser-data.txt file, at

http://www.wxsim.com/plaintext-parser-data.txt

The plaintext file I’m trying to read is at

http://www.wxsim.com/plaintext.txt

The icons are in the

http://www.wxsim.com/forecast/images

directory.

Any idea what I’m doing wrong?

Thanks! :slight_smile:

Tom

When you edit with Notepad, are you changing the “Save as type” field at the bottom to “All files”? Notepad saves the file as type “text” by default.

Now I think you’ll have to rename plaintext-parser_php.htm to a .php extension so PHP will know to process it.

  • Jim

Well, I tried changing the .htm extension to .php. That still did the same thing. This is Ken’s exact download, with no modifications or editing.

What’s strange is that there are no error messages. Also, when I run www.wxsim.com/test.php, it executes as PHP, like it should.

Any ideas?

Thanks!

Tom

I think once a file is created as type text, it wants to stay that way, even when that file is renamed later. Try uploading a fresh copy, making sure Notepad doesn’t save it as type text.

Be sure you upload in ASCII mode, some “auto” mode FTP may screw it up.

Tom,

I downloaded a copy of your file and got the same results on my server. I then looked at the code and the answer is in Pinto’s post above. Try a search and replace and change all ocurances of < to < and > with > . Those two symbols are vital for PHP to know when to stop and start.

Now how those got changed? …

  • Jim

Tom,

Better yet, get another copy from here http://saratoga-weather.org/plaintext-parser.php?sce=view then just do a File-Save as and save it as a text file. Once you’ve done that, the first line should be <?php and the last line in the file should be ?> . If they’re not, we still have a problem getting a good download.

  • Jim

Thanks - that got it going! :slight_smile:

The difference seems to have been the link, as I did the same thing with both as far as I could tell. I expect I’ll be doing some fine-tuning and then linking to it from my web page. For the moment, you can see it at www.wxsim.com/wxsimatl.php.

I expect I’ll be looking at many of my customers’ web pages for idea! :slight_smile:

Tom