How to run PHP scripts using XAMPP

I am learning PHP and oone of my has given me a software XAMPP which can run PHP scripts....but i dont know how to use it.So if anyone knows about it then plz tell me....

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    nicepeeyush
    I am learning PHP and oone of my has given me a software XAMPP which can run PHP scripts....but i dont know how to use it.So if anyone knows about it then plz tell me....
    Using XAMPP is very easy. Follow these steps -

    1. Run the XAMPP application. Turn on Apache & MySQL (if your application needs database) services through it.
    2. Click on 'Explore' button on the XAMPP control panel - in the window that opens, check for htdocs folder.
    3. htdocs folder is the one where all your PHP scripts should lie. This is the folder that Apache points to.
    4. You might want to create a separate folder inside /htdocs/ folder to save all your PHP programs. Let's call it 'myprograms'.
    5. Save your php script in /htdocs/myprograms folder. (Ex. test.php)
    6. Now, start your webbrowser and type following address: #-Link-Snipped-#

    Your browser will now execute the script and show you the output.

    I hope this works for you. If you have further questions, feel free to ask πŸ˜€
  • Pensu
    Pensu
    Thanks Biggie...it worked....πŸ˜€
  • Anu18
    Anu18
    I tried as biggie told..but im nt getting the o/p..its cming as 403 forbidden error
  • Pensu
    Pensu
    403 forbidden error means that accessing to the file/folder you are trying to open has been denied. Misconfigurations and bad system or/and security and firewall settings can cause this error. Check this:

    #-Link-Snipped-#
  • Priyadharshini s
    Priyadharshini s
    Pensu ..thank you .. this helped me .
  • Rajeev NR
    Rajeev NR
    hai,... i am Rajeev from Kerala(INDIA). i am a fresher in php development. i would like to study about php language. i dont know anything about php...i installed XAMPP from net. now i am studying php tutorials...please help me, how can i run a php program ?
  • Kaustubh Katdare
    Kaustubh Katdare
    #-Link-Snipped-# : Read this post ->

    The_Big_K
    Using XAMPP is very easy. Follow these steps -

    1. Run the XAMPP application. Turn on Apache & MySQL (if your application needs database) services through it.
    2. Click on 'Explore' button on the XAMPP control panel - in the window that opens, check for htdocs folder.
    3. htdocs folder is the one where all your PHP scripts should lie. This is the folder that Apache points to.
    4. You might want to create a separate folder inside /htdocs/ folder to save all your PHP programs. Let's call it 'myprograms'.
    5. Save your php script in /htdocs/myprograms folder. (Ex. test.php)
    6. Now, start your webbrowser and type following address: #-Link-Snipped-#

    Your browser will now execute the script and show you the output.

    I hope this works for you. If you have further questions, feel free to ask πŸ˜€
  • Abhishek Swain
    Abhishek Swain
    Rajeev NR
    hai,... i am Rajeev from Kerala(INDIA). i am a fresher in php development. i would like to study about php language. i dont know anything about php...i installed XAMPP from net. now i am studying php tutorials...please help me, how can i run a php program ?
    I suggest you to go for WAMP SERVER. It's hassle free !
  • Abhishek Swain
    Abhishek Swain
    Abhishek Swain
    I suggest you to go for WAMP SERVER. It's hassle free !
    As easy as 1-2-3
    1) Install Wamp Server
    2) Start Wamp Server using your Desktop icon.
    3) Copy your project files to c:/wamp/www folder
    4) Open your browser and type 127.0.0.1
    5) Select your desired folder ffrom the project folders' list.

    It's Done !
  • Kaustubh Katdare
    Kaustubh Katdare
    WAMP and XAMPP both work almost the same way. Even XAMPP is easy to use; and I've never had any problems with it. The best thing about XAMPP is that they keep their package up to date with the latest versions of the web and database servers.

    It's been long time since I used XAMPP though. Not aware of the latest developments. πŸ˜€
  • Abhishek Swain
    Abhishek Swain
    The_Big_K
    WAMP and XAMPP both work almost the same way. Even XAMPP is easy to use; and I've never had any problems with it. The best thing about XAMPP is that they keep their package up to date with the latest versions of the web and database servers.

    It's been long time since I used XAMPP though. Not aware of the latest developments. πŸ˜€
    Yes, even XAMPP is good. After all it depends on your choice. I have started my way with wamp server. So thought of suggesting others. 😁
  • Rajeev NR
    Rajeev NR
    thank you very much dear,..i will expect more helps in the future ....go may bless you
  • emilydecker
    emilydecker
    hey! myself emily decker from london(UK). i am a developer in php, i like this news....good one
    My Blog
  • Programmist
    Programmist
    I don't know much about XAMPP but WAMP is way too easy to use in all ways for meπŸ˜€ .
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    Actually XAMPP has more configuration options and will baffle the newbies and render it difficult to run... WAMP doesn't have much options and it is easy! πŸ˜€
  • soumikdas22
    soumikdas22
    sir i m having a difficulty with xampp .its showing 404 error ..
    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 #-Link-Snipped-#.
    Error 404

    #-Link-Snipped-#
    06/06/12 23:01:58
    Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1



  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    What URL did you enter? Try WAMP Server and let us know!
  • soumikdas22
    soumikdas22
    Praveen-Kumar
    What URL did you enter? Try WAMP Server and let us know!
    i am not sure what happened yesterday.. now it is working fine..
  • iam12
    iam12
    What does error 404 mean?
  • iam12
    iam12
    The_Big_K
    #-Link-Snipped-# : Read this post ->
    epic fail always get error 404
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    iam12
    What does error 404 mean?
    The 404 or Not Found error message is a HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested.
  • xheavenlyx
    xheavenlyx
    I have written an updated tutorial on XAMPP installation and getting started with development. It's very basic and for anyone who would stumble on this thread:

    #-Link-Snipped-#
  • simiraj
    simiraj
    hi.. your description is very usaefull for me.,..... thank u
  • atulmittal0109
    atulmittal0109
    Kaustubh Katdare
    Using XAMPP is very easy. Follow these steps -

    1. Run the XAMPP application. Turn on Apache & MySQL (if your application needs database) services through it.
    2. Click on 'Explore' button on the XAMPP control panel - in the window that opens, check for htdocs folder.
    3. htdocs folder is the one where all your PHP scripts should lie. This is the folder that Apache points to.
    4. You might want to create a separate folder inside /htdocs/ folder to save all your PHP programs. Let's call it 'myprograms'.
    5. Save your php script in /htdocs/myprograms folder. (Ex. test.php)
    6. Now, start your webbrowser and type following address: #-Link-Snipped-#

    Your browser will now execute the script and show you the output.

    I hope this works for you. If you have further questions, feel free to ask πŸ˜€
    Hi Kaustabh,

    I have tried that but when I run my file at #-Link-Snipped-#
    It is showing error as "Object not found". What may be the problem? I have followed exactly the above steps
  • Kaustubh Katdare
    Kaustubh Katdare
    #-Link-Snipped-# : Several things to know -

    1. Does the file exist at /myprograms/ folder (physically) . That is check the htdocs folder and then go to 'myprograms' folder inside it and see if the file's there.

    2. Is php_check.php error free?

    3. Do other files in your document root work fine?
  • atulmittal0109
    atulmittal0109
    Look, I installed the Xampp server and when installed, I started the control panel. After that, I turn on the Apache ans MySQL(though MySQL is not working for some reason). Now, I clicked on the explorer and in htdocs folder, I created a folder named as "myprograms" and then I created a file with name "php_check.php" in this folder. The code written in the file is as below:
    (

    PHP Check File

    print "

    Congratulations, your server can process PHP!

    ";
    print "

    Here you can view the PHP configuration on your server

    ";
    phpinfo( );
    exit();
    ?>

    Sorry, PHP is not enabled on this server.




    Check your host provider documentation or contact
    your host provider to ask them how to enable PHP.




    )

    Now, when I type the address in my browser as #-Link-Snipped-#
    it is still showing the same "object not found error"
  • atulmittal0109
    atulmittal0109
    Hi,

    I have got the solution. There was something wrong with the file extension. Thanks for your time and help.
  • Kaustubh Katdare
    Kaustubh Katdare
    You don't need to put that file in the myprograms folder. If you just want to test whether XAMPP is working or not, you can put that file directly in htdocs folder and then access it from #-Link-Snipped-# . Also check if your browser can render any text file if you put it in htdocs folder and access it from #-Link-Snipped-#.

    If that doesn't work - your setup may have issues. Check whether XAMPP\apache\conf\httpd.conf is pointing to the right directory. Look for something that says "DocumentRoot".
  • atulmittal0109
    atulmittal0109
    Its working fine now both with php and text files. Thanks
  • Nayan Goenka
    Nayan Goenka
    If you get struck at some errors and you think Xampp is working fine, try check your code for some missing tags. I had a recent experience when I screwed up some tags in the code that lead to malfunction. It was a stupid mistake and it was fixed easily but i had to waste a lot of time in to it.
  • Tushar Kathuria
    Tushar Kathuria
    I am also getting the same error 404.I entered url #-Link-Snipped-#
    Folder myprograms is saved in htdocs and test.php in myprograms.
    please help me otherwise i will not even be able to start using php.
  • Kaustubh Katdare
    Kaustubh Katdare
    @#-Link-Snipped-# - welcome to CrazyEngineers. Every setup is different; so we need to know what you've on your machine so that we can provide possible solutions.

    You should perform quick checks-
    • Is your default XAMPP page loading fine?
    • If you put any text file say test.txt in /htdocs/ are you able to view it in browser by typing #-Link-Snipped-# ?
    Are you able to load other files in the same directory or in htdocs?
  • Manish Goyal
    Manish Goyal
    Tushar Kathuria
    I am also getting the same error 404.I entered url #-Link-Snipped-#
    Folder myprograms is saved in htdocs and test.php in myprograms.
    please help me otherwise i will not even be able to start using php.
    Are you working on linux? on linux paths are case sensitive, so make sure directory name is exactly same as you are accessing on browser
  • NIRAJ PANDEY
    NIRAJ PANDEY
    I installed xampp on ma lappy..m newbie in php development..i tried to run php sript..bt browser dnt pops anythng inside php code...help
  • Ankita Katdare
    Ankita Katdare
    NIRAJ PANDEY
    I installed xampp on ma lappy..m newbie in php development..i tried to run php sript..bt browser dnt pops anythng inside php code...help
    Share the exact steps you performed. That will help us know what went wrong. We will guide you from there.
  • NIRAJ PANDEY
    NIRAJ PANDEY
    apache is running..


    My first php





    Dis is the script which i saved as test.php inside xampp\htdocs\nirajphp folder..
    Then i opened chrome and typed #-Link-Snipped-#
    title is displayed bt nothing is echoed..
  • Ankita Katdare
    Ankita Katdare
    #-Link-Snipped-#

    To echo something, you can just write this code inside the test.php file.

    echo "Hello World";
    ?>

    That should work. πŸ‘
  • NIRAJ PANDEY
    NIRAJ PANDEY
    tht worked thanxx..!! plzz cn u explain wat ws wrng in my code?
  • Manish Goyal
    Manish Goyal
    you were using short code which might have disabled in your php.ini settings

    For more info
    PHP: PHP tags - Manual

You are reading an archived discussion.

Related Posts

TechnicBRICKs: TBs TechTips 31 - Sequential gearbox 7+R, by Sheepo Including a Veyron with working gearbox!
Honda's developed a personal mobility vehicle (I think the news is old, but I found it few minutes ago πŸ˜‰ ) and its called U3-X. U3-X takes the unicycles to...
A magnitude 7.7 earthquake shook Indonesia's northwest island of Sumatra early Wednesday, triggering a small tsunami, snapping power lines and sending panicked residents rushing for higher ground. There were scattered...
is there any way to get dos prompt over login screen ? like when my system boots up it shows up the user name and password but instead of logging...
A study has shown switching fonts for printing can save on ink. Century Gothic and Times New Roman top the savings list. Century Gothic uses 30% less ink in printing...