SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2011
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Script not working?

    I have xampp installed, I have a document with this code:

    Code:
    <html>
    <body>
    
    <?php
    function myCompanyMotto(){
    echo "We deliver quantity, not quality!<br />";
    }
    echo "Welcome to Tizag.com <br />";
    myCompanyMotto();
    echo "Well, thanks for stopping by! <br />";
    echo "and remember... <br />";
    myCompanyMotto();
    ?>
    
    </body>
    </html>
    named index.php in the htdocs folder, I type http://localhost/index.php in my browser and don't see the above? Does the XAMPP Control panel need to be opened before I can see any scripts on my browser or does it have to be opened at all or does it not matter if it's open or closed or any other reason why I am not seeing the code's output in my browser?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    If you start up the server and point your browser to
    http://127.0.0.1
    do see it?

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2011
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    xampp is already opened and SVC boxes for both Apache and MYSQL are checked and both services shows "running". When I do what you say, same deal
    but now when I refresh the browser page now I am seeing:

    Hello World

    I am wondering if localhost is pointing to the file named index.php in the php folder and not the file of the same name which is in the htdocs folder? No, that would not make sense because thos words are not in any of the index.php files, strange, isn't the a utility somewhere where I can post php ocde to test like jslint does with javascript?

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,189
    Mentioned
    191 Post(s)
    Tagged
    2 Thread(s)
    I'm guessing the "hello world" you're seeing is the page XAMPP shows to let you know you've installed it OK. That's not altogether bad, at least you got that far.

    You probably missed doing something(s) during configuration.

    On Windows?
    Did you run setup_xampp.bat ?

  5. #5
    SitePoint Zealot
    Join Date
    Feb 2011
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can't remember how I installed xampp but it say it installed correctly and I was able to run a script on it before.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •