Is my Php really working ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
klchan
Forum Newbie
Posts: 1
Joined: Tue Oct 20, 2009 7:04 am

Is my Php really working ?

Post by klchan »

Dear all,

I'm an absolute beginner in the area of PHP, Apache and MySQL. So, please endure my too basic question.

I installed XAPMM and configured what the book (Apress PHP For Absolute Beginners) recommended.

When i issue http://localhost/xampp/, i see the XAMPP page, which i pressume my installation is OK.

Then i created a file called test.php with the contents below :

<?php
echo “Hello world!”;
?>


But when i run it by issuing http://localhost/Ezyledger/test.php

I got
Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Ezyledger\test.php on line 2

Then i tried to replace the test.php with the following :

<script language="php">
echo 'This is some text';
</script>


Then i see the text (This is some text).

My question is is my PHP / Apache configured properly and working fine ? It is important because else, i cannot follow the example in the book that i am trying to learn from there.

Your valuable advice is highly appreciated.
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

Re: Is my Php really working ?

Post by Reviresco »

Not sure, but the problem may be that you are using "curly" quotes -- try replacing them with straight quotes or apostrophes:

Code: Select all

<?php
echo "Hello World!";
echo 'Hello World!';
?>
Curly quotes are often the result of coding in a word processing program like Word. Try Notepad, TextEdit, etc. instead.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: Is my Php really working ?

Post by josh »

Yep its the quotes, thats why I prefer single quotes.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Is my Php really working ?

Post by John Cartwright »

Moved to PHP-Code.

Does nobody read the forum descriptions anymore :(
Post Reply