Thread: PHP error

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0

    Question PHP error


    Hello all,

    I am a new user in Php world. I had no computer background. Well I wanted to learn PHP and SQL to gain some skills and for that reason I installed MAMP on my mac. The ports i have changed to 80 for Apache and 3306 for mysql, but it did not work so i just changed it back to default which 8888 and 8889 something like that. I do not have web server directory in my macbook, i m using OSX 10.8 mountain lion and there is no web sharing option. I have also got the text editer where I type the php commands and code. I saved the file with .php extension. Since I do not have the "Sites" directory in my mac, so I have saved this file under MAMP folder > htdocs > firstphp > index.php "firstphp" is the folder name i created under htdocs where i save all my php files. now the problem is whenever i type

    http://localhost8888/htdocs/index.php
    http://localhost/htdocs/index.php
    http://localhost/MAMP/htdocs/index.php
    http://localhost/MAMP/htdocs/firstphp/index.php

    I have recieved errors like that

    "Not Found

    The requested URL /MAMP/htdocs/firstphp/index.php was not found on this server."

    I tried all these ways to check whether my php code works but unfortunately it didn't worked. everything is running properly, such as php, apache and mysql. Now, can anyone please help me out with this...and please explain in easier way as i dont have any computer background, otherwise i keep ask u questions. Your help will be much appreciate it. Thanks in advance !!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Dec 2004
    Posts
    2,969
    Rep Power
    374
    http://localhost8888/htdocs/index.php should be:

    http://localhost:8888/htdocs/index.php

    usually when I use WAMP an icon appears in the system tray, not sure if this is the same for MAMP.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by paulh1983
    http://localhost8888/htdocs/index.php should be:

    http://localhost:8888/htdocs/index.php

    usually when I use WAMP an icon appears in the system tray, not sure if this is the same for MAMP.
    I have also tried this way, but it opens some websites free domain host websites i meant.... didnt worked either !!!
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    What? When you should be seeing your local web pages, you see "some website" instead? That sounds like malware.

    As to the problem:

    Unless you've fumbled with the Apache configuration, the document root is your "htdocs" directory. Every path you enter into the address bar is mapped to this directory. So a URL with the path /index.php would map to the file <your MAMP path>/htdocs/index.php. The "htdocs" must not be in the URL, because your webserver would try to find <your MAMP path>/htdocs/htdocs/, which most probably doesn't exist.

    By the way, when you type in http://localhost:8888/, you should see all the content of your htdocs folder listed. That way you can get the correct paths.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2013
    Posts
    4
    Rep Power
    0
    i think he is right ...

IMN logo majestic logo threadwatch logo seochat tools logo