Page 1 of 1

Having problem in viewing php on localhost

PostPosted: 10. September 2010 12:51
by lrasan
Hi,

I'm new to php programming and still learning. i installed xampp and both apache and mysql are indicated as running in the xampp control pannel. when i type http://localhost/ it takes me to the xampp main page.

but the php file i created using notepad wouldn't load. its a simple program with a single php line. i saved it in the htdocs folder ;
D:\xampp\htdocs\project1\test.php

when i try to view this page the following error show up;

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
localhost
9/10/2010 5:06:37 PM
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1


the browser i am using is firefox, i tried view the page saving it directly in the htdocs folder but it still wont work, but the index.php page which was in xampp by default in the htdocs folder works fine.

please help me to solve this problem, thank you in advance

Re: Having problem in viewing php on localhost

PostPosted: 10. September 2010 15:17
by Altrea
What do you type in your browser address bar to request your file D:\xampp\htdocs\project1\test.php?

Re: Having problem in viewing php on localhost

PostPosted: 11. September 2010 04:27
by lrasan
thanks for the reply :)

i type http://localhost/project1/test.php

i am following a book to learn php, so this is whats said in the book to type in
but when it didn't work i typed http://localhost/htdocs/project1/test.php still it didn't work

Re: Having problem in viewing php on localhost

PostPosted: 11. September 2010 06:23
by JonB
check the file name in Windows explorer, see if it might be test.php.txt :shock:

Good Luck
:)

Re: Having problem in viewing php on localhost

PostPosted: 11. September 2010 10:23
by lrasan
thank you JonB for the help :D

i checked in detail view, the document file type showed as php, but just to make sure i turned off Hide extensions for known file types from folder options, renamed the file as .PHP then viewed on browser with no problem.

thanks a lot :lol:

Re: Having problem in viewing php on localhost

PostPosted: 11. September 2010 14:36
by JonB
I'm glad its fixed. That is a common problem when people try to use Notepad for doing tasks its really not up to.

You should find a programmers' editor. Even the simplest free ones can save you endless time with little errors. Almost all do syntax highlighting (makes code very readable AND often reveals errors) and some have auto-completion (provides 'hints, possible values).

here's a good list
http://www.thefreecountry.com/programming/editors.shtml

I use the 'Emeral Editor' (it had a recent name change -- it used to be the Crimson Editor) and I have also used Notepad++.

http://www.emeraldeditor.com/

There are also fee full blown IDE's (Integrated Devlopment Environements) if you pursue things further (they are also a big learning curve). I use several of them for 'big tasks'. But for Perl or PHP quick work, I use the Cromson Editor.

Good Luck
8)

Re: Having problem in viewing php on localhost

PostPosted: 12. September 2010 10:25
by lrasan
:D thank you again jonB for the valuable info

i use dreamweaver for the basic php scripts i made. I am a student and still on the very basics of php and learning, I am going to find a better editor from the lists in the site you posted. :wink:

the next big hurdle i got to go through is connecting a database and getting it to work properly, i know i might sound silly to you'll but I use books and online resources to learn php by my self :) So, yes it is difficult for me but i will try my best. Every little bit of tips and info you give is very useful for me

thanks again :D