Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Hii ,

I am a beginner in PHP .I would like to know how one can execute a PHP script using XAMPP server ... ??

Any suggestions ... :)

share|improve this question
add comment

closed as off topic by mdpc, RobM, voretaq7 Jan 22 '13 at 23:43

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers

Assuming Windows:

Navigate to your "localhost" folder (usally): C:\xampp\htdocs

Create a new folder called "ravi", and inside that folder create a file called: index.php

Put all your PHP code in that index.php file and save the file.

Then, after starting XAMPP, navigate to: http://localhost/ravi/

And you'll see your script running.

Gav

share|improve this answer
add comment

Of course your index.php should follow the php rules. For example your code has to start with

<?php

and end with ?>

You can use this tutorial http://www.w3schools.com/php/php_syntax.asp to get some information regarding php how-to

share|improve this answer
add comment

1) Open the XAMPP Control Panel from the start menu.
2) To the right of where it says "Apache" click 'Start' button.
3) On the right side of the screen, click the 'Explore' button.
4) Open the "htdocs" folder. This will be your working directory where you put your php files.
5) As a test, make a new file called "hello.php" and put the following code in it:

<?php echo "Hello world!"; ?>

6) Now in your browser (Firefox, Chrome, Internet Explorer, etc.) go to either of the following two links to run your PHP script from step 5:

http://127.0.0.1/hello.php
http://localhost/hello.php
share|improve this answer
add comment

I am new to PhP and as mentioned by you above i tried the same process but still i am not able to see the output, in fact i am getting the following error. Could anyone look it and help me in solving my problem.

Object not found!

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster. Error 404 127.0.0.1 Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7

share|improve this answer
    
Your answer might be better addressed as a simple comment. –  mdpc Jan 22 '13 at 21:20
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.