basic php code - problem

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
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

basic php code - problem

Post 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
thecodewall
Forum Commoner
Posts: 33
Joined: Sun Dec 26, 2010 8:37 am

Re: basic php code - problem

Post 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
kalpesh.mahida
Forum Commoner
Posts: 36
Joined: Wed Oct 06, 2010 7:09 am

Re: basic php code - problem

Post 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
User avatar
spedula
Forum Commoner
Posts: 81
Joined: Mon Mar 29, 2010 5:24 pm

Re: basic php code - problem

Post 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.
Mince
Forum Commoner
Posts: 25
Joined: Mon Aug 03, 2009 9:36 am

Re: basic php code - problem

Post 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.
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

Re: basic php code - problem

Post 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
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

Re: basic php code - problem

Post by viki »

Thank you for the replies guys,

I will follow the advice given here and get back to you.
Thank you again.
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

Re: basic php code - problem

Post 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
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

Re: basic php code - problem

Post 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.
viki
Forum Newbie
Posts: 6
Joined: Wed Jan 12, 2011 7:28 pm

Re: basic php code - problem

Post by viki »

Thank you guys...

I I am using XAMPP and it is perfect.
Post Reply