php doesn't work

Problems with the Windows version of XAMPP, questions, comments, and anything related.

php doesn't work

Postby meafafan » 12. November 2010 18:32

hi y'all
i installed xampp and it went just fine. no problems.
i started the apache and mysql in the control panel.
i wrote a simple php code:
Code: Select all
<?php
echo "Hello World";
?>

but the browser shows an empty page.
what m i missing here?
(win xp sp3, firefox 3.6)

thank u all
meafafan
meafafan
 
Posts: 3
Joined: 12. November 2010 18:23

Re: php doesn't work

Postby Altrea » 12. November 2010 19:29

HOW do you open the file in the browser?
WHERE is the file saved?

And Million of the same questions in the forum already. But to try the search isn't an opinion for you, i know.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: php doesn't work

Postby meafafan » 12. November 2010 20:43

oh, u r too kind...actually i try searching the forum the keyword "PHP" alone and got: "No suitable matches were found." :S
i found a similar question but with no answer.
i'm not lazy, i'm working on it for several hours and register 2 this forum just 4 this question after a long search.
anyway, thank u for trying.

i tried to open the file in the browser by two ways:
1. open file (ctrl+o)
2. i open an HTML file that calls the same simple php file

the file is located in a different drive in a different folder than xampp, does it matter?

sry 4 being a noob
i just started learning php
meafafan
 
Posts: 3
Joined: 12. November 2010 18:23

Re: php doesn't work

Postby Altrea » 12. November 2010 21:03

meafafan wrote:oh, u r too kind...actually i try searching the forum the keyword "PHP" alone and got: "No suitable matches were found." :S
i found a similar question but with no answer.

Oh, thats right. Sorry for that. Some stop or short words don't work alone. But if you add one more word in your search request that should work.

meafafan wrote:i tried to open the file in the browser by two ways:
1. open file (ctrl+o)
2. i open an HTML file that calls the same simple php file

Both can't work. PHP is a serverside programming language. It can't work locally, because your Browser can't know, that you run a webserver and that all .php files should be send through the php parser.
Therefor you have installed an Apache Webserver in your XAMPP package. Your Webserver knows that .php Files must be send to the php parser.
But your Webserver don't serve local files. You had to request your files with the http protocol.

Therefor you first had to save your .php files inside the xampp\htdocs folder or into a subfolder of it. htdocs is the startfolder (documentroot) for the webserver, so the webserver knows, if someone requests a file, he starts to look in your document root folder.

For example: If you have a file test.php in the folder c:\xampp\htdocs\projectxyz\, the correct url would be http://localhost/projectxyz/test.php
(localhost is just an alias for 127.0.0.1 which is every pcs self reference ip-address.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: php doesn't work

Postby meafafan » 12. November 2010 21:45

OMG!
you are the man!

thank u so much for ur patience and the detailed answer.
u opened 2 me the great door of server-side-scripting.

Now, I say to you today my friend, even though we face the difficulties of today and tomorrow, I still have a dream. It is a dream deeply rooted in the developer's dream. I have a dream that one day this commuinty will rise up and live out the true meaning of its creed: - We hold these truths to be self-evident, that all noobs are created equal.

i'll remember u when i conquer earth with my future empire.
i'll flood u with money, provide u livestock and women (or men - just name it).
i will name my first daughter after u and crown u as the new ruler of altrealand! (Not yet established)

be aware of the influence u have on ppl, especially the youth and the noobs.
in the name of mankind, be patient! and together we'll create a better world!
meafafan
 
Posts: 3
Joined: 12. November 2010 18:23

Re: php doesn't work

Postby Altrea » 12. November 2010 21:54

You are a little bit crazy, i think that is one of the requirements to be a good programmer in the future :mrgreen:

meafafan wrote:i will name my first daughter after u

better your first son. Otherwise that could be a little bit funny :shock:

meafafan wrote:thank u so much for ur patience and the detailed answer.
u opened 2 me the great door of server-side-scripting.


You are welcome, my friend. I wish you all the best for your first steps of dynamic webside programming.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 32 guests