Click to See Complete Forum and Search --> : Browser not finding files on localhost


spufi
10-29-2003, 05:51 PM
Installed Apache 2 and PHP 4. I went and set everything up, and I created a file named test.php which basically has a echo statement saying "Hi!" I tried it and it worked. I figured I was good to go. I try today and when I use my text editor, I get pretty much a page with the PHP code showing on it. Since the text editor is pointing to my file through the C drive and not localhost, I figure I will go and look at it in my browser. I do this with using localhost as part of the URL and I now get a message saying the file can't be found. I even use my drop down menu to locate my test file with the URL pointing to the localhost, and I still get nothing. Now, I know it's there becasue it worked yesterday, and yes, the server is on. Any ideas?

EDIT: I can use the browser to find the files on my computer, but again, I get the PHP code showing when I try to display a PHP page.

PunkSktBrdr01
10-29-2003, 06:28 PM
Did you have the server running when you tried to use localhost?

pyro
10-29-2003, 09:37 PM
I would use Apache 1.3.28 for now, as support for Apache 2 is experimental:

from PHP 4.3.3's install.txt
------------------------------------------------------------
ATTENTION: Apache 2 Users

At this time, support for Apache 2 is experimental. It's
highly recommended you use PHP with Apache 1.3.x and not
Apache 2. Documentation for installing Apache 2 on windows
can be seen here:

http://www.php.net/manual/en/install.apache2.php

With the basic difference being that when installing as a
module you'll use php4apache2.dll instead of php4apache.dll
Both files are included within this release.
------------------------------------------------------------

spufi
10-29-2003, 11:55 PM
Experimental is one thing, rolling dice and wondering what the result is going to be is much different. When I logged back on to my laptop, I went and tried it. This time I got the test page to work, but when I tried my mock order form it wasn't passing the data to the variables so it kept saying I didn't order anything. I already tested the form on my site because I was using that to test stuff out. Anyway, I'm not exactly excited about downloading v1.3 and then going back and setting up PHP with it, but at least I played around so much getting PHP working in the first place, it shouldn't be as bad this next time.

pyro
10-30-2003, 07:03 AM
Did you, by chance, use globalvariables (http://www.webdevfaqs.com/php.php#globalvariables)? PHP doesn't necessarily work the same from server to server, due to the fact that it can be customized. Using global variables is about the biggest way to ensure you scripts won't work on all servers.

spufi
10-30-2003, 09:17 AM
So if I define a variable like $_POST["qtyTire"], it should work on all servers, but if I define it like $qtyTire, then it will only work on servers set up to handle it that way? Now, I just have to figure out if I want to be able to use the shorthand version, or stick with the longer one because at least with the longer way the added definition also helps in knowing what the variable is about, ie seeing if it's a variable that's part of a form, session, etc. I think as a PHP newbie, it would be better if I did the long version for now. ;)

pyro
10-30-2003, 09:39 AM
And once you know more PHP, you'll know better than to use the "short version" (register_globals) ;). You can read why here (http://us4.php.net/manual/en/security.registerglobals.php), or where it's changed in the php.ini file here (http://us4.php.net/manual/en/configuration.directives.php#ini.register-globals). I'd highly recommend not using register_globals... :)