I did a search, but didn't find any answers so hopefully someone has an idea what is wrong with my set up.
I'm using php 5.2.6 and Apache 2.2 as I work my way through the PHP & mySQl for Dummies book.
I've saved a couple php files in the htdocs folder that Apache looks at for php files.
If I type in the URL bar in Firefox: localhost\test.php, it works great. However, if I type in:
"C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/test.php"
or open up the folder and double click on the test.php file, I get a blank page with a box asking me what application to open the file with.
My Apache config file has the following setting activated:
DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
so as far as I can tell, it is set correct.
Is there something I am missing?
Thanks!
Problem with opening php files on localhost
Moderator: General Moderators
Re: Problem with opening php files on localhost
It's operating the way it's supposed to. When you specify a FILE in a browser, it does not use a web server at all. You can do that on any computer, even without having a web server installed. Now, PHP requires a web browser (like Apache) to parse and execute the PHP code, so of course it won't do that when you refer to a FILE instead of the web server, which is what you do when you refer to localhost.
Re: Problem with opening php files on localhost
Ok thanks.
Is there any easier way to open a php file in a browser without typing in the location in the address bar?
Is there any easier way to open a php file in a browser without typing in the location in the address bar?
Re: Problem with opening php files on localhost
Umm, with your PHP editor?ncarty97 wrote:Ok thanks.
Is there any easier way to open a php file in a browser without typing in the location in the address bar?
Re: Problem with opening php files on localhost
I'm just using conText for php editing, so it doesn't run the programs. I was going to play around with a trial version of phpED, but not sure I'm going to shell out the money for it.
Re: Problem with opening php files on localhost
Let me try again: PHP is a scripting language that is parsed and executed by a web server. That's its purpose, in order to serve dynamic documents to browsers. Not only is there not an easier way to execute PHP, there is no other way than by using a web server.ncarty97 wrote:Ok thanks.
Is there any easier way to open a php file in a browser without typing in the location in the address bar?
Re: Problem with opening php files on localhost
OK thanks. I suppose I can just make a favorite or something.