473,471 Members | 4,625 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem with simple php code

I'm just learning php, and one of the first things in the book I'm
reading has me make this file-
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
Phpinfo();
?>
</body>
</html>

I typed in in Notepad, saved it as test.php, ftp it to my ISP, then
viewed in a browser and got the following error-
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/home/fearofdo/public_html/test2.php on line 9

I asked my ISP if php/mysql was installed and turned on and configured
correctly, they said yes and that my code was wrong, that it had <93>
and <94where there should have been quotes, so they changed it and
now it works, creating the proper display.

This is all very odd to me...when I look at the original file that my
ISP said they corrected, there are now double quotes around the line
This is a PHP line. I created a new file from scratch, made sure it had
quotes, uploaded it and what do you know, I get the error message
again. When I view the file/code from my FTP client, it shows the
quotes, absolutely the correct code, so why is it not working?

I guess my question is, what the heck is happening? I'm not even sure
where to begin...how and why is the code getting changed, and if it is
getting changed, why does it not look to me like it has changed, and
why the <93>...where does that come from? How do I prevent this?

Nov 22 '06 #1
19 1925
I don't know anything about <93or <94tags, but the code you posted
works fine on my setup.

You mentioned that you saved it as "test.php", but then said the error
occured at "/home/fearofdo/public_html/test2.php". Are you sure you
are looking at only one file? test.php vs. test2.php?

Nov 22 '06 #2

<al***@fearofdolls.comwrote in message
news:11*********************@m7g2000cwm.googlegrou ps.com...
I'm just learning php, and one of the first things in the book I'm
reading has me make this file-
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
Phpinfo();
?>
</body>
</html>

I typed in in Notepad, saved it as test.php, ftp it to my ISP, then
viewed in a browser and got the following error-
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/home/fearofdo/public_html/test2.php on line 9

I asked my ISP if php/mysql was installed and turned on and configured
correctly, they said yes and that my code was wrong, that it had <93>
and <94where there should have been quotes, so they changed it and
now it works, creating the proper display.

This is all very odd to me...when I look at the original file that my
ISP said they corrected, there are now double quotes around the line
This is a PHP line. I created a new file from scratch, made sure it had
quotes, uploaded it and what do you know, I get the error message
again. When I view the file/code from my FTP client, it shows the
quotes, absolutely the correct code, so why is it not working?

I guess my question is, what the heck is happening? I'm not even sure
where to begin...how and why is the code getting changed, and if it is
getting changed, why does it not look to me like it has changed, and
why the <93>...where does that come from? How do I prevent this?
The only thing springs to mind is, what transfer mode are you using with
your FTP software. Are you using auto, binary or ASCII.
Your script works fine this end.
Regards,

Brent Palmer.
Nov 22 '06 #3
On 21 Nov 2006 16:37:41 -0800, al***@fearofdolls.com wrote:
>I'm just learning php, and one of the first things in the book I'm
reading has me make this file-
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
Phpinfo();
?>
</body>
</html>

I typed in in Notepad, saved it as test.php, ftp it to my ISP, then
viewed in a browser and got the following error-
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/home/fearofdo/public_html/test2.php on line 9

I asked my ISP if php/mysql was installed and turned on and configured
correctly, they said yes and that my code was wrong, that it had <93>
and <94where there should have been quotes, so they changed it and
now it works, creating the proper display.
Don't know how this is happening in Notepad but it looks to me like it
could be smart quotes characters 91 and 92 instead of a single quote.

Characters (decimal) 93 and 94 are ] and ^
--
Regards, Paul Herber, Sandrila Ltd. http://www.pherber.com/
Diacrit accented characters http://www.diacrit.sandrila.co.uk/
Email address in headers is invalid.
Nov 22 '06 #4
kd****@gmail.com wrote:
I don't know anything about <93or <94tags, but the code you posted
works fine on my setup.

You mentioned that you saved it as "test.php", but then said the error
occured at "/home/fearofdo/public_html/test2.php". Are you sure you
are looking at only one file? test.php vs. test2.php?
Yes, test2 was the second one I created, a duplicate of the first just
so I could see the error again. It created that error, yet when I view
it, it looks fine, it should work.

Nov 22 '06 #5
>
The only thing springs to mind is, what transfer mode are you using with
your FTP software. Are you using auto, binary or ASCII.
It's in binary mode.

Nov 22 '06 #6
al***@fearofdolls.com wrote:
>>The only thing springs to mind is, what transfer mode are you using with
your FTP software. Are you using auto, binary or ASCII.


It's in binary mode.
Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.

Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #7

Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.
That must be the problem, but I am using notepad. What else can I use
that would not change it?
Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.
That is true I guess...I haven't changed that setting in FTP for years,
and I've transfered all kinds of files without any problems before.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #8
On 11/21/2006 7:37 PM, al***@fearofdolls.com wrote:
I'm just learning php, and one of the first things in the book I'm
reading has me make this file-
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
Phpinfo();
?>
</body>
</html>

I typed in in Notepad, saved it as test.php, ftp it to my ISP, then
viewed in a browser and got the following error-
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/home/fearofdo/public_html/test2.php on line 9

I asked my ISP if php/mysql was installed and turned on and configured
correctly, they said yes and that my code was wrong, that it had <93>
and <94where there should have been quotes, so they changed it and
now it works, creating the proper display.

This is all very odd to me...when I look at the original file that my
ISP said they corrected, there are now double quotes around the line
This is a PHP line. I created a new file from scratch, made sure it had
quotes, uploaded it and what do you know, I get the error message
again. When I view the file/code from my FTP client, it shows the
quotes, absolutely the correct code, so why is it not working?

I guess my question is, what the heck is happening? I'm not even sure
where to begin...how and why is the code getting changed, and if it is
getting changed, why does it not look to me like it has changed, and
why the <93>...where does that come from? How do I prevent this?
Try writing your file like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>First PHP Script</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>

That should return the PHP Info page.

Dave Pyles
Nov 22 '06 #9

al***@fearofdolls.com wrote:
>
Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.

That must be the problem, but I am using notepad. What else can I use
that would not change it?
Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.
Well transfering it in ASCII didn't help.

Nov 22 '06 #10

Dave Pyles wrote:
On 11/21/2006 7:37 PM, al***@fearofdolls.com wrote:
I'm just learning php, and one of the first things in the book I'm
reading has me make this file-
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>This is an HTML line
<p>
<?php
echo "This is a PHP line";
Phpinfo();
?>
</body>
</html>

I typed in in Notepad, saved it as test.php, ftp it to my ISP, then
viewed in a browser and got the following error-
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in
/home/fearofdo/public_html/test2.php on line 9

I asked my ISP if php/mysql was installed and turned on and configured
correctly, they said yes and that my code was wrong, that it had <93>
and <94where there should have been quotes, so they changed it and
now it works, creating the proper display.

This is all very odd to me...when I look at the original file that my
ISP said they corrected, there are now double quotes around the line
This is a PHP line. I created a new file from scratch, made sure it had
quotes, uploaded it and what do you know, I get the error message
again. When I view the file/code from my FTP client, it shows the
quotes, absolutely the correct code, so why is it not working?

I guess my question is, what the heck is happening? I'm not even sure
where to begin...how and why is the code getting changed, and if it is
getting changed, why does it not look to me like it has changed, and
why the <93>...where does that come from? How do I prevent this?
Try writing your file like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>First PHP Script</title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>

That should return the PHP Info page.
I could do that, but that's not really the issue, the issue is, why is
what I'm doing not working in the first place, according to the book it
should work, and if it's not I don't really know how to proceed. This
is very discouraging for someone just trying to learn how to use PHP
and other web technology.
Dave Pyles
Nov 22 '06 #11
al***@fearofdolls.com wrote:
al***@fearofdolls.com wrote:
>>>Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.

That must be the problem, but I am using notepad. What else can I use
that would not change it?

>>>Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.

Well transfering it in ASCII didn't help.
No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.

It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #12
Maybe I'll try it in Word.

Jerry Stuckle wrote:
al***@fearofdolls.com wrote:
al***@fearofdolls.com wrote:
>>Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.
That must be the problem, but I am using notepad. What else can I use
that would not change it?
Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.

Well transfering it in ASCII didn't help.

No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.

It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #13
al***@fearofdolls.com wrote:
Jerry Stuckle wrote:
>>al***@fearofdolls.com wrote:
>>>al***@fearofdolls.com wrote:
>Are you really using MS Notepad, or are you using something else? x'93'
>and x'94' are the left and right quote symbols in some other programs
>like Wordpad, but I haven't seen Notepad save them that way.
>

That must be the problem, but I am using notepad. What else can I use
that would not change it?

>Also, you're transferring ascii data, so you should be using ascii
>transfer mode. But that won't cause this problem.
>

Well transfering it in ASCII didn't help.

No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.

It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


Maybe I'll try it in Word.
(Top posting fixed)

Word is definitely the WRONG way to go. You need an ASCII text editor,
not a word processor.

In fact, WORD will give you exactly the problem you're seeing, even if
you save it in text format. Even the x'93' and x'94" characters.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #14

Jerry Stuckle wrote:
al***@fearofdolls.com wrote:
al***@fearofdolls.com wrote:
>>Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.
That must be the problem, but I am using notepad. What else can I use
that would not change it?
Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.

Well transfering it in ASCII didn't help.

No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.
Well here's another problem...if I create it in word, I can't save it
as a .php file. I could save it as .txt then change it, but won't that
mess it up?
It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #15
>==================

Maybe I'll try it in Word.
>

(Top posting fixed)

Word is definitely the WRONG way to go. You need an ASCII text editor,
not a word processor.

In fact, WORD will give you exactly the problem you're seeing, even if
you save it in text format. Even the x'93' and x'94" characters.
What should I be creating it in then? The book I'm reading doesn't
really say. I new that Notepad would allow me to save it with the .php
name.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #16
al***@fearofdolls.com says...
That must be the problem, but I am using notepad. What else can I use
that would not change it?
Heaps of other code/text editors, my favourite for PHP is Crimson Editor,
syntax highlighting, built-in FTP. Google for it.

Geoff M
Nov 22 '06 #17
al***@fearofdolls.com wrote:
Jerry Stuckle wrote:
>>al***@fearofdolls.com wrote:
>>>al***@fearofdolls.com wrote:
>Are you really using MS Notepad, or are you using something else? x'93'
>and x'94' are the left and right quote symbols in some other programs
>like Wordpad, but I haven't seen Notepad save them that way.
>

That must be the problem, but I am using notepad. What else can I use
that would not change it?

>Also, you're transferring ascii data, so you should be using ascii
>transfer mode. But that won't cause this problem.
>

Well transfering it in ASCII didn't help.

No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.


Well here's another problem...if I create it in word, I can't save it
as a .php file. I could save it as .txt then change it, but won't that
mess it up?

>>It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

True, you do have to rename it. But renaming it can't screw up the file
- it's already been screwed up by Word.

I have no idea why notepad doesn't work for you. It always has for me.

As for other possibilities - try googling for

notepad replacement

A bunch of them come up, most of them free. Some people I know use
Notepad2. I personally like textpad, but that's a commercial product
(only $30, but worth it, IMHO).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #18

Jerry Stuckle wrote:
al***@fearofdolls.com wrote:
Jerry Stuckle wrote:
>al***@fearofdolls.com wrote:

al***@fearofdolls.com wrote:
Are you really using MS Notepad, or are you using something else? x'93'
and x'94' are the left and right quote symbols in some other programs
like Wordpad, but I haven't seen Notepad save them that way.
That must be the problem, but I am using notepad. What else can I use
that would not change it?

Also, you're transferring ascii data, so you should be using ascii
transfer mode. But that won't cause this problem.
Well transfering it in ASCII didn't help.
No, ASCII just affects the newline characters. But if you're uploading
the a Unix system you'll see them each line has an extra ^M in a Unix
editor such as vim.

I've tried it here on W2K and W2K3 Server, and I haven't been able to
duplicate it. But I find it easy to do in word processors.

Well here's another problem...if I create it in word, I can't save it
as a .php file. I could save it as .txt then change it, but won't that
mess it up?

>It's a very interesting problem. Wish I had an answer for you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

True, you do have to rename it. But renaming it can't screw up the file
- it's already been screwed up by Word.

I have no idea why notepad doesn't work for you. It always has for me.

As for other possibilities - try googling for

notepad replacement

A bunch of them come up, most of them free. Some people I know use
Notepad2. I personally like textpad, but that's a commercial product
(only $30, but worth it, IMHO).

Well that was it. I found a program called Notepad++, and after using
that it worked fine. Apparently Windows Notepad adds something to it
that doens't translate well.
Thanks :-)
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '06 #19
Message-ID: <11**********************@e3g2000cwe.googlegroups. comfrom
al***@fearofdolls.com contained the following:
>Well that was it. I found a program called Notepad++, and after using
that it worked fine. Apparently Windows Notepad adds something to it
that doens't translate well.
Thanks :-)
That's the one I use. It's great.

Do you have your computer set to hide common extensions?
(clutching at straws here...)

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Nov 22 '06 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: fripper | last post by:
I posted this problem a couple of days ago but felt I might have better luck re-stating the problem. Apparently I messed up IIS (v. 5) somehow because I am suddenly unable to load web forms! A...
10
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
0
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
7
by: Ankit Aneja | last post by:
I put the code for url rewrite in my Application_BeginRequest on global.ascx some .aspx pages are in root ,some in folder named admin and some in folder named user aspx pages which are in user...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
7
by: Lorenzino | last post by:
Hi, I have a problem with bindings in a formview. I have a formview; in the insert template i've created a wizard control and inside it i have an HTML table with some textboxes bound to the...
3
by: Robert Johnson | last post by:
Hi all. Created a simple table in my db. 3 colums one is a Int set for autoincrement. Itentity True, seed 1, Incremement 1, null False. The other colums are simple VarChar(50) null false on the...
30
by: Einstein30000 | last post by:
Hi, in one of my php-scripts is the following query (with an already open db-connection): $q = "INSERT INTO main (name, img, descr, from, size, format, cat, host, link, date) VALUES ('$name',...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.