Page 1 of 1

basic php code - problem

Posted: Wed Jan 12, 2011 7:48 pm
by viki
Hi Guys,

I am sorry for asking this question this is very basic stuff from PHP.
I've just started learning PHP and I have no prior knowledge in web programming.
I have installed Apache 2.2 and have installed PHP version 5.3.5 Win 32 VC9. (Using Vista )
The Apache server is configured and correctly and working. I created the following php file and saved it in document root. (using notepad)

<?php
phpinfo();
?>

The above code is everything I got in my test.php file.
When I try to view it with my browser it does not run the code but it is showing me a "open", "save" message box. It seems the code is not interpreted.
Can someone please tell me why it doesnt work? and what I can do about it? Where can the problem be?

Thank you.

Kind Regards,
Viki

Re: basic php code - problem

Posted: Wed Jan 12, 2011 8:04 pm
by thecodewall
I think there something wrong in your setup, it doest not allow php to display. try this post http://codewall.blogspot.com/2011/01/cr ... ogram.html, It think this may help.

codewall.blogspot.com

Re: basic php code - problem

Posted: Wed Jan 12, 2011 9:53 pm
by kalpesh.mahida
Or if you dont want to manually configure PHP with Apache you can have all this on one single bundle,
XAMPP or WAMP which will install and configure PHP,Apache and MySQL for you.

You can find XAMPP here and WAMP here

Re: basic php code - problem

Posted: Wed Jan 12, 2011 11:06 pm
by spedula
Just curious. How are you accessing the file in your browser?

Like this:

C:/path/to/file/test.php

or:

localhost/test.php

The later would be the correct method. Also, you need to configure your virtual host to point to the location of your public_html or www folder.

Re: basic php code - problem

Posted: Thu Jan 13, 2011 7:16 am
by Mince
I had the same problem when starting out. What spedula says here is true.
spedula wrote: C:/path/to/file/test.php
or:
localhost/test.php
Also, if using XAMPP for example, make sure your apache services etc are running.

Re: basic php code - problem

Posted: Thu Jan 13, 2011 7:42 pm
by viki
spedula wrote:Just curious. How are you accessing the file in your browser?

Like this:

C:/path/to/file/test.php

or:

localhost/test.php

The later would be the correct method. Also, you need to configure your virtual host to point to the location of your public_html or www folder.
I am accessing the file in the following way.

localhost/test.php

Re: basic php code - problem

Posted: Thu Jan 13, 2011 7:43 pm
by viki
Thank you for the replies guys,

I will follow the advice given here and get back to you.
Thank you again.

Re: basic php code - problem

Posted: Thu Jan 13, 2011 11:06 pm
by viki
thecodewall wrote:I think there something wrong in your setup, it doest not allow php to display. try this post http://codewall.blogspot.com/2011/01/cr ... ogram.html, It think this may help.

codewall.blogspot.com
Thank you, the link helped me. I am using XAMPP and it is working now.

Thanks again

Re: basic php code - problem

Posted: Thu Jan 13, 2011 11:07 pm
by viki
kalpesh.mahida wrote:Or if you dont want to manually configure PHP with Apache you can have all this on one single bundle,
XAMPP or WAMP which will install and configure PHP,Apache and MySQL for you.

You can find XAMPP here and WAMP here
Thank you for the advice and links, I am using XAMPP and it works perfet.

Re: basic php code - problem

Posted: Thu Jan 13, 2011 11:09 pm
by viki
Thank you guys...

I I am using XAMPP and it is perfect.