I know this is a dumb question... I feel dumb for asking it, but I'm confused. So the problem is, I'll make a little basic php page, and save it with the .php extension... but when I go to open it in my browser, nothing shows up but a blank white screen. What's the problem here? I've installed and uninstalled XAMPP a few times things I did something wrong. I followed to installation guide in "PHP and MySQL for Dummies" and then the installation and "creating a php file in dreamweaver" guide on adobe.com. I'm using Notepad++ and Adobe Dreamweaver Cs4. How do you open the .php file in a browser?
(Yes I'm a complete newb to php, but I can't practice when I'm too dumb to open the files, lol.)
How to test/open a .php file?
Moderator: General Moderators
-
English Fire
- Forum Newbie
- Posts: 3
- Joined: Wed Apr 07, 2010 7:42 pm
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: How to test/open a .php file?
Do these PHP files actually output anything? Do they have HTML between <?php ?> tags? Do they call echo()?
(#10850)
Re: How to test/open a .php file?
If you're trying to open the php file directly with your browser, that won't work. php pages have to be "served up" by the web server, so you need to use something like http://127.0.0.1/mypage.php to view a php page.
-
English Fire
- Forum Newbie
- Posts: 3
- Joined: Wed Apr 07, 2010 7:42 pm
Re: How to test/open a .php file?
@Chris - The script I'm trying to use is copied directly out of the book I'm using. The scripts correct, it just had no output at all, just blank page. EDIT, now I get an error(look below).
@Doug - Hm... ok I'll try and mess around with it, I think I know what you're saying.
Is there a certain folder I should put my scripts in?
*EDIT*
Ok so here's what's going on. I go to http://127.0.0.1/try.php (try.php is what I named the document), and I get the following;
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
4/8/2010 7:34:20 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
So what's the problem? Where do I save the .php file, in what folder?
(also, when I go to http://127.0.0.1/, the front page for XAMPP shows up..so yeah.
@Doug - Hm... ok I'll try and mess around with it, I think I know what you're saying.
Is there a certain folder I should put my scripts in?
*EDIT*
Ok so here's what's going on. I go to http://127.0.0.1/try.php (try.php is what I named the document), and I get the following;
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
4/8/2010 7:34:20 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
So what's the problem? Where do I save the .php file, in what folder?
(also, when I go to http://127.0.0.1/, the front page for XAMPP shows up..so yeah.
Re: How to test/open a .php file?
In a linux apache setup often the web root is /var/www/html/ but I don't know where it is in xampp. Locate your httpd.conf file and find the document root setting which should point to the proper path, or check the xampp documentation which should tell you where web files go in a windows environment. I haven't used xampp in a while myself, sorry.
-
English Fire
- Forum Newbie
- Posts: 3
- Joined: Wed Apr 07, 2010 7:42 pm
Re: How to test/open a .php file?
Ok I'll look around and see if I can spot anything and then I'll post what I find here in a second....
Well I found htdocs folder, and inside that folder the a "index.php" file saved. I tried opening that, same error as I got with my own .php file.
ANOTHER UPDATE...
ok now for some reason everytime I click a .php file in my computer, it opens up a "open save cancel" download screen... so I tried exiting that, no good, tried opening, and it closes and reopens itself, and save, which saves something, and opens the exact some window...
Thanks for all your help guys, this thread has now use now... cause...
VICTORY!@@@@@@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
it worked =D
Well I found htdocs folder, and inside that folder the a "index.php" file saved. I tried opening that, same error as I got with my own .php file.
ANOTHER UPDATE...
ok now for some reason everytime I click a .php file in my computer, it opens up a "open save cancel" download screen... so I tried exiting that, no good, tried opening, and it closes and reopens itself, and save, which saves something, and opens the exact some window...
Thanks for all your help guys, this thread has now use now... cause...
VICTORY!@@@@@@!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
it worked =D