Page 1 of 1

Is my Php really working ?

Posted: Tue Oct 20, 2009 7:29 am
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.

Re: Is my Php really working ?

Posted: Tue Oct 20, 2009 9:14 am
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.

Re: Is my Php really working ?

Posted: Tue Oct 20, 2009 3:31 pm
by josh
Yep its the quotes, thats why I prefer single quotes.

Re: Is my Php really working ?

Posted: Tue Oct 20, 2009 3:45 pm
by John Cartwright
Moved to PHP-Code.

Does nobody read the forum descriptions anymore :(