i dont understand the very beginning

i want to use echo for writing… but it have troubles… when i do this:

1st site
hello

is shows hello, but when i do this:

1st site
<?php echo "hello"; ?>

is shows nothing… what am i doing wrong?

just to clarify, is the file saved as a html or php?

.php

Just tested with this on my server and my php returned “hello” fine. have you done a phpinfo() to see if it’s turned on ok?

[php]

1st site
<?php echo "hello"; ?>
[/php]

what is a phpinfo()
where do i have to put that? and how can i see if it works?
can the problem be in this line?:

I’ve added the doctype to my file and it’s still working on my server. a phpinfo file is simply a test file to make sure php is switched on.

create a new file and you only need to add 1 line and save it as a .php file. then upload to your server and goto the page. If it outputs a lot of information regarding PHP 5.0 or not.

File code:

<?php phpinfo(); ?>

i dont have a server, i make the file and open it with google chrome…
do you need a server to check your page?

yes, php files work better when hosted rather than opened locally.

ok ty, i saw i can maybe use localhost to look at it… the file is in C -> school -> site and its called index.php
what do i have to fill in my adresbar to look at the site?

if you mean http://localhost/ But you’d need a webserver installed locally to view it. Not sure there is another way round this.

ty, i installed xampp and it works now :slight_smile:

Use the code button when posting code so it is shown correctly.

Sponsor our Newsletter | Privacy Policy | Terms of Service