Jump to content

New to PHP


Recommended Posts

Hi, I just started learning php and I would like to know how to properly test or view my php file in a browser (mine is FireFox). I have PHP-MySQL-Apache installed here and my OS is windowsXP. My apache is running but when I tried to view the php file in the browser, it displays the exact code, not the would be output... Then I figured that a correct path is needed. I dunno how the path goes except [a href=\"http://localhost/<<what\" target=\"_blank\"]http://localhost/<<what[/a] next?>>. It show 404 error file can't be found. Should I place my php files in a specific folder for it to run?

Thank you in advance to those who would lend a helping hand.
Link to comment
Share on other sites

Your PHP files will need to be in the folder in which the APache can see, them which is most probably the htdocs folder, C:\Program Files\Apache Group\Apache 2\htdocs by defualt unless you have stated otheriwse in the httpd.conf.

When you goto [a href=\"http://localhost/\" target=\"_blank\"]http://localhost/[/a] you should see a list of files and folders currently in your htdocs folder, if you dont but you are getting the Apache message clear the contents of the htdocs folder and you should now see a directory listing.
Link to comment
Share on other sites

I have WAMP installed (package of php5-apache2-mysql5). Under apache2, there is no htdocs folder. Should I make one? When I typed in [a href=\"http://localhost\" target=\"_blank\"]http://localhost[/a], it displayed a start page of WAMP containing my server config, tools, projects, etc., but no directory or files. The path of my apache2 is C:\wamp\Apache2\<<no-htdocs-folder>>. Am I using a different kind of apache or is there a way around this?
Link to comment
Share on other sites

If you have WAMP installed then look for a folder called www in the root of the WAMP folder, C:\wamp\www

You place all your documents in the www folder and then goto [a href=\"http://localhost/filename.php\" target=\"_blank\"]http://localhost/filename.php[/a] to run that file.
Link to comment
Share on other sites

OMG it worked!! [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Thank you so much!! Now I can go on with more tutorials here [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.